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