From 5bed96736aaee1444aa5868c3b13ae9c6fb2857e Mon Sep 17 00:00:00 2001 From: Dmitri Date: Sun, 19 Apr 2026 14:45:50 +0200 Subject: [PATCH] old options --- nvim/lua/kanopo/pack.lua | 40 +++++++++++++++++++++++---- nvim/lua/kanopo/plugins/telescope.lua | 2 +- nvim/nvim-pack-lock.json | 8 ++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/nvim/lua/kanopo/pack.lua b/nvim/lua/kanopo/pack.lua index 1d30a71..131203c 100644 --- a/nvim/lua/kanopo/pack.lua +++ b/nvim/lua/kanopo/pack.lua @@ -1,13 +1,35 @@ local gh = function(x) return 'https://github.com/' .. x end +local run = function(cmd, cwd) + local result = vim.system(cmd, { cwd = cwd, text = true }):wait() + if result.code ~= 0 then + local details = result.stderr ~= '' and result.stderr or result.stdout or '' + vim.notify(('Pack hook failed: %s\n%s'):format(table.concat(cmd, ' '), details), vim.log.levels.ERROR) + end +end + +local post_change = { + ['telescope-fzf-native.nvim'] = function(data) + run({ 'make' }, data.path) + end, + ['nvim-treesitter'] = function(data) + if not data.active then + vim.cmd.packadd('nvim-treesitter') + end + vim.cmd('TSUpdate') + end, +} local hooks = function(ev) - -- Use available |event-data| - local name, kind = ev.data.spec.name, ev.data.kind - -- Run build script after plugin's code has changed - if name == 'nvim-telescope/telescope-fzf-native.nvim' and (kind == 'install' or kind == 'update') then - -- Append `:wait()` if you need synchronous execution - vim.system({ 'make' }, { cwd = ev.data.path }):wait() + local data = ev.data + if not data or (data.kind ~= 'install' and data.kind ~= 'update') then + return + end + + local name = data.spec and data.spec.name + local hook = name and post_change[name] + if hook then + hook(data) end end vim.api.nvim_create_autocmd('PackChanged', { callback = hooks }) @@ -33,6 +55,12 @@ vim.pack.add({ { src = gh("nvim-lua/plenary.nvim")}, { src = gh("sindrets/diffview.nvim")}, { src = gh("nvim-telescope/telescope.nvim")}, + + -- git signs + { src = gh("lewis6991/gitsigns.nvim")}, + + -- treesitter + { src = gh("nvim-treesitter/nvim-treesitter")}, }, { confirm = false, }) diff --git a/nvim/lua/kanopo/plugins/telescope.lua b/nvim/lua/kanopo/plugins/telescope.lua index c99025c..eb4b3ac 100644 --- a/nvim/lua/kanopo/plugins/telescope.lua +++ b/nvim/lua/kanopo/plugins/telescope.lua @@ -31,7 +31,7 @@ if not fzf_ok then vim.notify("ERROR: (telescope) fzf not loaded") end local ui_select_ok, _ = pcall(require("telescope").load_extension, "ui-select") -if not ui_slect_ok then +if not ui_select_ok then vim.notify("ERROR: (telescope) ui select not loaded") end diff --git a/nvim/nvim-pack-lock.json b/nvim/nvim-pack-lock.json index 9d47cae..6ea208c 100644 --- a/nvim/nvim-pack-lock.json +++ b/nvim/nvim-pack-lock.json @@ -4,6 +4,10 @@ "rev": "4516612fe98ff56ae0415a259ff6361a89419b0a", "src": "https://github.com/sindrets/diffview.nvim" }, + "gitsigns.nvim": { + "rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, "gruvbox.nvim": { "rev": "154eb5ff5b96d0641307113fa385eaf0d36d9796", "src": "https://github.com/ellisonleao/gruvbox.nvim" @@ -12,6 +16,10 @@ "rev": "e906fce7e44ae562f06345be99a7db02f8315236", "src": "https://github.com/NeogitOrg/neogit" }, + "nvim-treesitter": { + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, "nvim-web-devicons": { "rev": "c72328a5494b4502947a022fe69c0c47e53b6aa6", "src": "https://github.com/nvim-tree/nvim-web-devicons"