diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index 0d2472d082..a4f7389fda 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -1409,6 +1409,7 @@ function M.del(names, opts) lock_read() + local successful_delete = {} --- @type string[] local fail_to_delete = {} --- @type string[] for _, p in ipairs(plug_list) do if not active_plugins[p.path] or opts.force then @@ -1416,11 +1417,10 @@ function M.del(names, opts) vim.fs.rm(p.path, { recursive = true, force = true }) active_plugins[p.path] = nil - notify(("Removed plugin '%s'"):format(p.spec.name), 'INFO') - plugin_lock.plugins[p.spec.name] = nil trigger_event(p, 'PackChanged', 'delete') + successful_delete[#successful_delete + 1] = p.spec.name else fail_to_delete[#fail_to_delete + 1] = p.spec.name end @@ -1428,6 +1428,12 @@ function M.del(names, opts) lock_write() + if #successful_delete > 0 then + local suffix = #successful_delete == 1 and '' or 's' + local plugs = table.concat(successful_delete, ', ') + notify(('Removed plugin%s: %s'):format(suffix, plugs), 'INFO') + end + if #fail_to_delete > 0 then local plugs = table.concat(fail_to_delete, ', ') if opts._ex then diff --git a/test/functional/plugin/pack_spec.lua b/test/functional/plugin/pack_spec.lua index c6bb3121a1..996b2dd1e8 100644 --- a/test/functional/plugin/pack_spec.lua +++ b/test/functional/plugin/pack_spec.lua @@ -2329,7 +2329,7 @@ describe('vim.pack', function() assert_on_disk({ basic = false, defbranch = true, plugindirs = false }) - local msg = "vim.pack: Removed plugin 'basic'\nvim.pack: Removed plugin 'plugindirs'" + local msg = 'vim.pack: Removed plugins: basic, plugindirs' eq(msg, n.exec_capture('messages')) -- `:packdel` should output E5810 instead of the normal error @@ -2357,7 +2357,7 @@ describe('vim.pack', function() assert_on_disk({ basic = false, defbranch = false, plugindirs = false }) - eq("vim.pack: Removed plugin 'defbranch'", n.exec_capture('messages')) + eq('vim.pack: Removed plugin: defbranch', n.exec_capture('messages')) log = exec_lua('return _G.event_log') find_event = make_find_packchanged(log)