1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
return {
{
'nvim-treesitter/nvim-treesitter',
branch = 'main',
lazy = false,
build = ':TSUpdate',
config = function(_, opts)
-- enable indent
vim.api.nvim_create_autocmd('FileType', {
callback = function()
pcall(vim.treesitter.start)
vim.bo.indentexpr = [[v:lua.require'nvim-treesitter'.indentexpr()]]
end,
})
-- auto-install
local already_installed = require('nvim-treesitter').get_installed()
local parsers_installable = vim
.iter(opts.ensure_installed)
:filter(function(parser)
return not vim.tbl_contains(already_installed, parser)
end)
:totable()
require('nvim-treesitter').install(parsers_installable)
end,
opts = {
ensure_installed = {
'bash',
'c',
'cmake',
'comment',
'cpp',
'css',
'dockerfile',
'go',
'gomod',
'gotmpl',
'gowork',
'html',
'javascript',
'json',
'lua',
'make',
'markdown',
'markdown_inline',
'ninja',
'python',
'regex',
'rust',
'scss',
'sql',
'todotxt',
'toml',
'typescript',
'typst',
'vim',
'vimdoc',
'yaml',
'zig',
},
},
},
}
|