Update treesitter vor nvim 0.12

This commit is contained in:
Alexander Gehrke 2026-04-01 16:09:14 +02:00
parent 8831bbe952
commit af39061406
5 changed files with 157 additions and 172 deletions

View file

@ -1,16 +1,58 @@
require("nvim-treesitter.configs").setup({
ensure_installed = { "typescript" },
sync_install = true,
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
require("nvim-treesitter").install({
"bash",
"c",
"cmake",
"comment",
"cpp",
"gitignore",
"go",
"html",
"java",
"javascript",
"json",
"jsx",
"ledger",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"rust",
"scala",
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
"zsh",
})
local augroup = vim.api.nvim_create_augroup("treesitter-init", {})
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"cpp",
"cmake",
"go",
"java",
"javascript",
"javascriptreact",
"ledger",
"lua",
"markdown",
"python",
"rust",
"typescript",
"typescriptreact",
"scala",
},
callback = function()
vim.treesitter.start()
vim.opt.foldmethod = "expr"
vim.opt.foldlevel = 99
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
end,
group = augroup,
})