From acb8445fbb658edf21e6af5f9b2f932a921655df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Uruba?= Date: Mon, 20 Apr 2026 10:54:40 +0200 Subject: [PATCH] nvim: Update treesitter plugin for nvim 0.12 --- .../nvim/lua/lazy-plugins/lsp-treesitter.lua | 59 +++++++++++-------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/nvim/.config/nvim/lua/lazy-plugins/lsp-treesitter.lua b/nvim/.config/nvim/lua/lazy-plugins/lsp-treesitter.lua index ceeaaa7..5107aa0 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/lsp-treesitter.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/lsp-treesitter.lua @@ -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 = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) - 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 = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - }, + } + + 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",