diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-09-13 23:32:09 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-13 13:32:09 -0700 |
| commit | a41703d107da4479635f8c9ebcd14409e6a7d648 (patch) | |
| tree | ee8a9ad0a6fd77b3305dd70c4bd337219238480a /runtime/lua/vim/pack.lua | |
| parent | ec89c5b261642e7af2d3f5f975f031c7ec1d0db2 (diff) | |
| download | rneovim-a41703d107da4479635f8c9ebcd14409e6a7d648.tar.gz rneovim-a41703d107da4479635f8c9ebcd14409e6a7d648.tar.bz2 rneovim-a41703d107da4479635f8c9ebcd14409e6a7d648.zip | |
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.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
| -rw-r--r-- | runtime/lua/vim/pack.lua | 11 |
1 files changed, 9 insertions, 2 deletions
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[] |