From 30f16b554bb8e74f5c1415de3f94a1b67e10cf33 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 29 Aug 2026 19:05:36 -0500 Subject: [PATCH] added PlugClean --- nvim/lua/darcula/usercmds.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/nvim/lua/darcula/usercmds.lua b/nvim/lua/darcula/usercmds.lua index 6310bbb..1b5f235 100644 --- a/nvim/lua/darcula/usercmds.lua +++ b/nvim/lua/darcula/usercmds.lua @@ -38,6 +38,38 @@ vim.api.nvim_create_user_command( {} ) +vim.api.nvim_create_user_command( + "PlugClean", + function() + local stale = vim.iter(vim.pack.get()) + :filter(function(plugin) + return not plugin.active + end) + :map(function(plugin) + return plugin.spec.name + end) + :totable() + + if #stale == 0 then + vim.notify("No stale plugins", vim.log.levels.INFO) + return + end + + table.sort(stale) + vim.pack.del(stale) + vim.notify( + string.format( + "Removed %d stale plugin%s: %s", + #stale, + #stale == 1 and "" or "s", + table.concat(stale, ", ") + ), + vim.log.levels.INFO + ) + end, + {} +) + if not NV_DARCULA_ENABLE_COC then vim.api.nvim_create_user_command( "LspInfo",