We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e94d65 commit f881830Copy full SHA for f881830
1 file changed
init.lua
@@ -1188,8 +1188,12 @@ require('lazy').setup({
1188
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
1189
-- vim.wo.foldmethod = 'expr'
1190
1191
+ -- check if treesitter indentation is available for this language, and if so enable it
1192
+ -- in case there is no indent query, the indentexpr will fallback to the vim's built in one
1193
+ local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
1194
+
1195
-- enables treesitter based indentation
- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
1196
+ if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
1197
end
1198
1199
local available_parsers = require('nvim-treesitter').get_available()
0 commit comments