From 12204c0edaa879c25f939e433562b9ad08983dfb Mon Sep 17 00:00:00 2001 From: kokopi-dev Date: Thu, 28 May 2026 01:39:40 +0900 Subject: [PATCH] fix:pack clean command --- nvim/lua/commands/pack.lua | 17 +++++++++++++++-- nvim/lua/plugins/registry.lua | 2 +- nvim/nvim-pack-lock.json | 4 ---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/nvim/lua/commands/pack.lua b/nvim/lua/commands/pack.lua index 3aa1e4e..9698e10 100644 --- a/nvim/lua/commands/pack.lua +++ b/nvim/lua/commands/pack.lua @@ -52,9 +52,22 @@ function M.setup() end, { desc = "Sync installed plugins to nvim-pack-lock.json" }) vim.api.nvim_create_user_command("PackClean", function() + local configured = M.registry(M.names()) + local configured_names = {} + local configured_srcs = {} + for _, spec in ipairs(configured) do + configured_names[spec.name] = true + if spec.src then + configured_srcs[spec.src] = true + end + end + local stale = vim.iter(vim.pack.get()) :filter(function(plugin) - return not plugin.active + local spec = plugin.spec + local configured_by_name = configured_names[spec.name] + local configured_by_src = spec.src and configured_srcs[spec.src] + return not configured_by_name and not configured_by_src end) :map(function(plugin) return plugin.spec.name @@ -75,7 +88,7 @@ function M.setup() vim.pack.del(stale) vim.notify("PackClean: removed " .. #stale .. " plugin(s)", vim.log.levels.INFO) - end, { desc = "Delete inactive vim.pack plugins from disk" }) + end, { desc = "Delete unconfigured vim.pack plugins from disk" }) end return M diff --git a/nvim/lua/plugins/registry.lua b/nvim/lua/plugins/registry.lua index 638c697..da31d80 100644 --- a/nvim/lua/plugins/registry.lua +++ b/nvim/lua/plugins/registry.lua @@ -25,7 +25,7 @@ M.map = { ["trouble.nvim"] = { name = "trouble.nvim", src = "https://github.com/folke/trouble.nvim" }, ["grug-far.nvim"] = { name = "grug-far.nvim", src = "https://github.com/MagicDuck/grug-far.nvim" }, ["nvim-ts-autotag"] = { name = "nvim-ts-autotag", src = "https://github.com/windwp/nvim-ts-autotag" }, - ["supermaven-nvim"] = { name = "supermaven-nvim", src = "https://github.com/supermaven-inc/supermaven-nvim" }, + -- ["supermaven-nvim"] = { name = "supermaven-nvim", src = "https://github.com/supermaven-inc/supermaven-nvim" }, ["symbol-usage"] = { name = "symbol-usage", src = "https://github.com/Wansmer/symbol-usage.nvim" }, } diff --git a/nvim/nvim-pack-lock.json b/nvim/nvim-pack-lock.json index 6940fe2..8810af3 100644 --- a/nvim/nvim-pack-lock.json +++ b/nvim/nvim-pack-lock.json @@ -84,10 +84,6 @@ "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", "src": "https://github.com/nvim-lua/plenary.nvim" }, - "supermaven-nvim": { - "rev": "07d20fce48a5629686aefb0a7cd4b25e33947d50", - "src": "https://github.com/supermaven-inc/supermaven-nvim" - }, "symbol-usage": { "rev": "6a449e6b37be61a110606e9a67a7a308774f120f", "src": "https://github.com/Wansmer/symbol-usage.nvim"