From a41703d107da4479635f8c9ebcd14409e6a7d648 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sat, 13 Sep 2025 23:32:09 +0300 Subject: feat(pack): confirm "Always" to install all plugins #35733 Problem: First clean start with config containing multiple `vim.pack.add()` calls requires to explicitly confirm each one. Although usually a rare occurrence, it still might be tedious. Solution: Add a third choice during installation confirmation that approves current and all next installs within current session. It is reset after session restart. --- runtime/lua/vim/pack.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/pack.lua') diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index 2962c994f7..40f1786ac5 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -416,18 +416,25 @@ local function run_list(plug_list, f, progress_action) report_progress('end', 100, '(%d/%d)', #funs, #funs) end +local confirm_all = false + --- @param plug_list vim.pack.Plug[] --- @return boolean local function confirm_install(plug_list) + if confirm_all then + return true + end + local src = {} --- @type string[] for _, p in ipairs(plug_list) do src[#src + 1] = p.spec.src end local src_text = table.concat(src, '\n') local confirm_msg = ('These plugins will be installed:\n\n%s\n'):format(src_text) - local res = vim.fn.confirm(confirm_msg, 'Proceed? &Yes\n&No', 1, 'Question') == 1 + local res = vim.fn.confirm(confirm_msg, 'Proceed? &Yes\n&No\n&Always', 1, 'Question') + confirm_all = res == 3 vim.cmd.redraw() - return res + return res ~= 2 end --- @param tags string[] -- cgit