From df6f39907ab219adfe4ce63556e1501eb9b51017 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:08 +0100 Subject: feat(nvim): add :PackList to show managed plugins with rev and version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses vim.pack.get() and prints one line per plugin: ● (active) or ○ (orphan), name, short rev, version spec. --- dot_config/nvim/lua/config/pack.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dot_config/nvim/lua/config/pack.lua b/dot_config/nvim/lua/config/pack.lua index bdef872..90b530e 100644 --- a/dot_config/nvim/lua/config/pack.lua +++ b/dot_config/nvim/lua/config/pack.lua @@ -25,6 +25,38 @@ local function update() vim.pack.update(nil, { force = true }) end +local function list() + local plugs = vim.pack.get() + table.sort(plugs, function(a, b) + return a.spec.name < b.spec.name + end) + local lines = {} + for _, p in ipairs(plugs) do + local mark = p.active and "●" or "○" + local ver = p.spec.version + if type(ver) == "table" then + ver = tostring(ver) + end + table.insert( + lines, + string.format( + "%s %-40s %-12s %s", + mark, + p.spec.name, + (p.rev or ""):sub(1, 8), + ver or "" + ) + ) + end + vim.api.nvim_echo( + vim.tbl_map(function(l) + return { l .. "\n" } + end, lines), + false, + {} + ) +end + vim.api.nvim_create_user_command("PackClean", clean, { desc = "Remove plugins not declared in vim.pack.add()", }) @@ -39,3 +71,7 @@ vim.api.nvim_create_user_command("PackSync", function() end, { desc = "Clean orphan plugins then update the rest", }) + +vim.api.nvim_create_user_command("PackList", list, { + desc = "List managed plugins (● active, ○ orphan)", +}) -- cgit v1.3.1