fix:pack clean command
This commit is contained in:
@@ -52,9 +52,22 @@ function M.setup()
|
|||||||
end, { desc = "Sync installed plugins to nvim-pack-lock.json" })
|
end, { desc = "Sync installed plugins to nvim-pack-lock.json" })
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("PackClean", function()
|
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())
|
local stale = vim.iter(vim.pack.get())
|
||||||
:filter(function(plugin)
|
: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)
|
end)
|
||||||
:map(function(plugin)
|
:map(function(plugin)
|
||||||
return plugin.spec.name
|
return plugin.spec.name
|
||||||
@@ -75,7 +88,7 @@ function M.setup()
|
|||||||
|
|
||||||
vim.pack.del(stale)
|
vim.pack.del(stale)
|
||||||
vim.notify("PackClean: removed " .. #stale .. " plugin(s)", vim.log.levels.INFO)
|
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
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ M.map = {
|
|||||||
["trouble.nvim"] = { name = "trouble.nvim", src = "https://github.com/folke/trouble.nvim" },
|
["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" },
|
["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" },
|
["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" },
|
["symbol-usage"] = { name = "symbol-usage", src = "https://github.com/Wansmer/symbol-usage.nvim" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,6 @@
|
|||||||
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
|
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
|
||||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||||
},
|
},
|
||||||
"supermaven-nvim": {
|
|
||||||
"rev": "07d20fce48a5629686aefb0a7cd4b25e33947d50",
|
|
||||||
"src": "https://github.com/supermaven-inc/supermaven-nvim"
|
|
||||||
},
|
|
||||||
"symbol-usage": {
|
"symbol-usage": {
|
||||||
"rev": "6a449e6b37be61a110606e9a67a7a308774f120f",
|
"rev": "6a449e6b37be61a110606e9a67a7a308774f120f",
|
||||||
"src": "https://github.com/Wansmer/symbol-usage.nvim"
|
"src": "https://github.com/Wansmer/symbol-usage.nvim"
|
||||||
|
|||||||
Reference in New Issue
Block a user