runtime(doc): Improve doc for cmdline-autocompletion

- Address https://github.com/vim/vim/pull/18219#issuecomment-3264634710
- Make the cmdline-autocompletion help more user friendly

closes: #18245

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-08 16:25:42 -04:00
committed by Christian Brabandt
parent 3980c86525
commit d7d6a6f05a
3 changed files with 96 additions and 22 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 06
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -12407,7 +12407,6 @@ wildmenumode() *wildmenumode()*
wildtrigger() *wildtrigger()*
Start wildcard expansion in the command-line, using the
behavior defined by the 'wildmode' and 'wildoptions' settings.
See |cmdline-completion|.
This function also enables completion in search patterns such
as |/|, |?|, |:s|, |:g|, |:v| and |:vimgrep|.
@ -12415,23 +12414,15 @@ wildtrigger() *wildtrigger()*
Unlike pressing 'wildchar' manually, this function does not
produce a beep when no matches are found and generally
operates more quietly. This makes it suitable for triggering
completion automatically, such as from an |:autocmd|.
completion automatically.
Note: After navigating command-line history, the first call to
wildtrigger() is a no-op; a second call is needed to start
expansion. This is to support history navigation in
command-line autocompletion.
See |cmdline-autocompletion|.
*cmdline-autocompletion*
Example: To make the completion menu pop up automatically
while typing on the command line: >
autocmd CmdlineChanged [:/\?] call wildtrigger()
set wildmode=noselect:lastused,full wildoptions=pum
<
To retain normal history navigation with the up/down keys: >
cnoremap <expr> <Up> wildmenumode() ? "\<C-E>\<Up>" : "\<Up>"
cnoremap <expr> <Down> wildmenumode() ? "\<C-E>\<Down>" : "\<Down>"
<
To apply an option only during a search, for example to set
'pumheight': >
autocmd CmdlineEnter [/\?] set pumheight=8
autocmd CmdlineLeave [/\?] set pumheight&
<
Return value is always 0.
Return type: |Number|