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.
This commit is contained in:
Marty Oehme 2024-06-17 10:31:39 +02:00
parent c4f2522f2b
commit 543a149da2
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -1,7 +1,23 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "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() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages -- one of "all", "maintained" (parsers with maintainers), or a list of languages
@ -63,7 +79,7 @@ return {
filetype = "nu", filetype = "nu",
} }
end, end,
event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" }, event = { "VeryLazy" },
cmd = { cmd = {
"TSBufDisable", "TSBufDisable",
"TSBufEnable", "TSBufEnable",
@ -83,24 +99,5 @@ return {
{ "<leader>si", "<cmd>Inspect<cr>", desc = "treesitter element", silent = true }, { "<leader>si", "<cmd>Inspect<cr>", desc = "treesitter element", silent = true },
{ "<leader>sI", "<cmd>InspectTree<cr>", desc = "treesitter tree", silent = true }, { "<leader>sI", "<cmd>InspectTree<cr>", 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,
}, },
} }