commit fe42c81f2e078a7fef8fc1ce639f9005e016298f
parent 70bb7999f7ecae0d250d0450fca26b42b53f38fe
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 8 Aug 2025 21:38:48 +0800
vim-patch:9.1.1608: No command-line completion for :unsilent {command}
Problem: No command-line completion for :unsilent {command}.
Solution: Add missing command arg completion (Doug Kearns).
(author)
Add completion tests for all command modifiers.
closes: vim/vim#17524
https://github.com/vim/vim/commit/126731c8fde545e8aedb83076badbc8a6ef1201d
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat:
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
@@ -2020,6 +2020,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
case CMD_tab:
case CMD_tabdo:
case CMD_topleft:
+ case CMD_unsilent:
case CMD_verbose:
case CMD_vertical:
case CMD_windo:
diff --git a/test/old/testdir/test_cmdmods.vim b/test/old/testdir/test_cmdmods.vim
@@ -1,5 +1,23 @@
" Test for all command modifiers in
+let s:luaeval_cmdmods =<< trim END
+ vim.iter(loadfile('../../../src/nvim/ex_cmds.lua')()):map(function(cmd)
+ if cmd.func == 'ex_wrongmodifier' or cmd.command == 'hide' then
+ return cmd.command
+ else
+ return nil
+ end
+ end):totable()
+END
+let s:cmdmods = []
+
+func s:get_cmdmods()
+ if empty(s:cmdmods)
+ let s:cmdmods = luaeval(s:luaeval_cmdmods->join("\n"))
+ endif
+ return s:cmdmods
+endfunc
+
func Test_keep_cmdmods_names()
call assert_equal('k', fullcommand(':k'))
call assert_equal('k', fullcommand(':ke'))
@@ -29,10 +47,13 @@ func Test_keep_cmdmods_names()
endfunc
func Test_cmdmod_completion()
- call assert_equal('edit', getcompletion('keepalt ed', 'cmdline')[0])
- call assert_equal('edit', getcompletion('keepjumps ed', 'cmdline')[0])
- call assert_equal('edit', getcompletion('keepmarks ed', 'cmdline')[0])
- call assert_equal('edit', getcompletion('keeppatterns ed', 'cmdline')[0])
+ for mod in s:get_cmdmods()
+ let cmd = $'{mod} ed'
+ if mod == 'filter'
+ let cmd = $'{mod} /pattern/ ed'
+ endif
+ call assert_equal('edit', getcompletion(cmd, 'cmdline')[0])
+ endfor
endfunc
" vim: shiftwidth=2 sts=2 expandtab