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
|
--
-- Treesitter parsers
--
vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" })
require("nvim-treesitter").install({
"bash",
"diff",
"gitcommit",
"ini",
"json",
"lua",
"markdown",
"markdown_inline",
"readline",
"vim",
"vimdoc",
})
-- Parse the tree as early as possible, which is as soon as we know the filetype
--
-- Event handlers for the same event are triggered in the order they were created. This must be the first FileType
-- handler created so that the tree is parsed for other FileType handlers (which often need the parsed tree). To create
-- it first put this in a file that comes before alphabetically in the `plugin/` directory.
vim.api.nvim_create_autocmd("FileType", {
desc = "Start treesitter",
group = vim.g.dotfiles.augroup,
callback = function()
local parser = vim.treesitter.get_parser(0)
if parser == nil then
return
end
parser:parse() -- Parse once asynchronously; used by logic that needs the parsed tree (like extmarks)
vim.treesitter.start()
end,
})
|