We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 16dd8f5 commit c7f05a0Copy full SHA for c7f05a0
1 file changed
init.lua
@@ -891,8 +891,12 @@ require('lazy').setup({
891
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
892
-- vim.wo.foldmethod = 'expr'
893
894
+ -- check if treesitter indentation is available for this language, and if so enable it
895
+ -- in case there is no indent query, the indentexpr will fallback to the vim's built in one
896
+ local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
897
+
898
-- enables treesitter based indentation
- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
899
+ if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
900
end
901
902
local available_parsers = require('nvim-treesitter').get_available()
0 commit comments