From 543a149da21f015051ccfe9a42d8b7ebb212dca9 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 17 Jun 2024 10:31:39 +0200 Subject: [PATCH] nvim: Update treesitter dependencies Moved rainbow delimiters into dependencies so that it runs with TS instead of loading TS on its own. Made TS itself more lazy (only loading on VeryLazy by default). Run TSUpdate on each run instead of only each build step. --- nvim/.config/nvim/lua/plugins/treesitter.lua | 39 +++++++++----------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 18e2e53..53306e2 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -1,7 +1,23 @@ return { { "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", + run = ":TSUpdate", + -- show current cursor context at top of buffer + -- improves commenting plugin above by using ts + dependencies = { + { "romgrk/nvim-treesitter-context", config = true }, + "JoosepAlviste/nvim-ts-context-commentstring", + "RRethy/nvim-treesitter-textsubjects", + "windwp/nvim-ts-autotag", + "RRethy/nvim-treesitter-endwise", + -- rainbow brackets using treesitter + { + "HiPhish/rainbow-delimiters.nvim", + config = function() + require("rainbow-delimiters.setup").setup({}) + end, + }, + }, config = function() require("nvim-treesitter.configs").setup({ -- one of "all", "maintained" (parsers with maintainers), or a list of languages @@ -63,7 +79,7 @@ return { filetype = "nu", } end, - event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" }, + event = { "VeryLazy" }, cmd = { "TSBufDisable", "TSBufEnable", @@ -83,24 +99,5 @@ return { { "si", "Inspect", desc = "treesitter element", silent = true }, { "sI", "InspectTree", desc = "treesitter tree", silent = true }, }, - - -- show current cursor context at top of buffer - -- improves commenting plugin above by using ts - dependencies = { - { "romgrk/nvim-treesitter-context", config = true }, - "JoosepAlviste/nvim-ts-context-commentstring", - "RRethy/nvim-treesitter-textsubjects", - "windwp/nvim-ts-autotag", - "RRethy/nvim-treesitter-endwise", - }, - }, - -- rainbow brackets using treesitter - { - "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", - lazy = false, - event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" }, - config = function() - require("rainbow-delimiters.setup").setup({}) - end, }, }