We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f0b4c3d + c0cc054 commit 3174e05Copy full SHA for 3174e05
1 file changed
lua/kickstart/plugins/treesitter.lua
@@ -25,8 +25,12 @@ return {
25
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
26
-- vim.wo.foldmethod = 'expr'
27
28
+ -- check if treesitter indentation is available for this language, and if so enable it
29
+ -- in case there is no indent query, the indentexpr will fallback to the vim's built in one
30
+ local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
31
+
32
-- enables treesitter based indentation
- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
33
+ if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
34
end
35
36
local available_parsers = require('nvim-treesitter').get_available()
0 commit comments