vim-patch:d7d6a6f: 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: vim/vim#18245

d7d6a6f05a

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-09 08:27:05 +08:00
parent 223f9622df
commit 327a2d57eb
4 changed files with 109 additions and 53 deletions

View File

@@ -13092,7 +13092,6 @@ M.funcs = {
desc = [==[
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|.
@@ -13100,22 +13099,15 @@ M.funcs = {
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|.
*cmdline-autocompletion*
Example: To make the completion menu pop up automatically as
you type on the command line, use: >vim
autocmd CmdlineChanged [:/\?] call wildtrigger()
set wildmode=noselect:lastused,full wildoptions=pum
<
To retain normal history navigation (up/down keys): >vim
cnoremap <Up> <C-U><Up>
cnoremap <Down> <C-U><Down>
<
To set an option specifically when performing a search, e.g.
to set 'pumheight': >vim
autocmd CmdlineEnter [/\?] set pumheight=8
autocmd CmdlineLeave [/\?] set pumheight&
<
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|.
Return value is always 0.
]==],
name = 'wildtrigger',