nvim: Update treesitter plugin for nvim 0.12

This commit is contained in:
2026-04-20 10:54:40 +02:00
parent 7a058f87f2
commit acb8445fbb

View File

@@ -1,30 +1,40 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
branch = "main",
lazy = false,
event = { event = {
"BufReadPre", "BufReadPre",
"BufNewFile", "BufNewFile",
}, },
main = "nvim-treesitter",
build = ":TSUpdate", build = ":TSUpdate",
dependencies = { dependencies = {
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
}, },
config = function(_, opts) config = function()
local treesitter = require("nvim-treesitter.configs") require("nvim-treesitter").setup({
highlight = {
enable = true,
},
indent = {
enable = true,
},
autotag = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
treesitter.setup(opts) local parsers = {
end,
opts = {
highlight = {
enable = true,
},
indent = {
enable = true,
},
autotag = {
enable = true,
},
ensure_installed = {
"bash", "bash",
"css", "css",
"dockerfile", "dockerfile",
@@ -47,17 +57,14 @@ return {
"twig", "twig",
"vim", "vim",
"yaml", "yaml",
}, }
incremental_selection = {
enable = true, for _, lang in ipairs(parsers) do
keymaps = { if not pcall(vim.treesitter.language.inspect, lang) then
init_selection = "<C-space>", vim.cmd("TSInstall " .. lang)
node_incremental = "<C-space>", end
scope_incremental = false, end
node_decremental = "<bs>", end,
},
},
},
}, },
{ {
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",