fix(indents): delegate indents for code blocks to treesitter instead of vim#1120
fix(indents): delegate indents for code blocks to treesitter instead of vim#1120dtvillafana wants to merge 1 commit intonvim-orgmode:masterfrom
Conversation
|
If you use nvim-treesitter indentexpr for a filetype that is being used in the code block, it should pull that up automatically. |
|
Ah, so this is really an error on my end... |
|
If your |
|
in my config (generated by nixvim): vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"then later on: vim.api.nvim_create_autocmd('FileType', {
pattern = 'org',
group = vim.api.nvim_create_augroup('org_indent_fix', { clear = true }),
callback = function()
local ok, orgmode = pcall(require, 'orgmode')
if ok then
vim.bo.indentexpr = "v:lua.require('orgmode.org.indent').indentexpr()"
end
end,
})maybe whatever version of treesitter/org grammar I was using was bad... relevant files in my config if you wanted to look: |
|
You shouldn't need to do this for org, it should automatically happen from here. What I meant is how do you set indentexpr in your other filetypes, like the ones that you use in your code blocks. For example, if you use lua in your code blocks, how do you set |
Summary
delegate indents for code blocks to treesitter instead of vim.
This fixes the issue where code blocks are incorrectly formatted for languages that vim does not have indents set up for.
The issue I was having was that the code blocks were not getting formatted according to the injections.scm that is already in the repo.
Related Issues
Related #
Closes #
Changes
delegate indents for code blocks to treesitter instead of vim
Checklist
I confirm that I have:
Conventional Commits
specification (e.g.,
feat: add new feature,fix: correct bug,docs: update documentation).make test.