Skip to content

Commit d5fcbd4

Browse files
committed
fix(treesitter_userconfig): update parser and filetype lists for treesitter installation and folding
Added additional parsers to ensure_installed and introduced a separate vim_filetypes list for accurate FileType autocmd pattern matching. This improves folding and syntax support for more filetypes.
1 parent bd21a57 commit d5fcbd4

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

after/plugin/treesitter_userconfig.lua

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,40 @@ local ensure_installed = {
3030
'terraform',
3131
'toml',
3232
'typescript',
33+
'tsx',
34+
'vim',
35+
'yaml',
36+
'zsh',
37+
}
38+
treesitter.install(ensure_installed)
39+
-- this is not always the same as treesitter parser names
40+
local vim_filetypes = {
41+
'bash',
42+
'css',
43+
'diff',
44+
'fish',
45+
'go',
46+
'graphql',
47+
'html',
48+
'ini',
49+
'javascript',
50+
'javascriptreact',
51+
'json',
52+
'lua',
53+
'make',
54+
'markdown',
55+
'python',
56+
'sql',
57+
'terraform',
58+
'toml',
59+
'typescript',
60+
'typescriptreact',
3361
'vim',
3462
'yaml',
3563
'zsh',
3664
}
37-
treesitter.install({ ensure_installed })
3865
vim.api.nvim_create_autocmd('FileType', {
39-
pattern = ensure_installed,
66+
pattern = vim_filetypes,
4067
callback = function()
4168
vim.opt.foldmethod = 'expr'
4269
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'

0 commit comments

Comments
 (0)