nvim: use vim.pack

This commit is contained in:
2025-12-20 10:30:27 +01:00
parent 48392501e1
commit 292de198a6
13 changed files with 475 additions and 428 deletions

View File

@@ -1,6 +1,26 @@
return {
main = "nvim-treesitter.configs",
opts = {
-- run ":TSUpdate" after plugin update
-- If hooks need to run on install, run this before `vim.pack.add()`
vim.api.nvim_create_autocmd("PackChanged", {
group = vim.api.nvim_create_augroup("nvim-treesitter-update", { clear = true }),
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if name == "nvim-treesitter" and kind == "update" then
if not ev.data.active then
vim.cmd.packadd("nvim-treesitter")
end
vim.cmd("TSUpdate")
print("TSUpdate done.")
end
end,
})
vim.pack.add({
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "master" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "master" },
})
local ok, configs = pcall(require, "nvim-treesitter.configs")
if ok then
configs.setup({
highlight = {
enable = true,
},
@@ -58,5 +78,7 @@ return {
},
},
},
},
}
})
else
print("plugin nvim-treesitter.configs missing")
end