patch 9.1.1738: cmdline-autocompletion breaks history navigation

Problem:  cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
          Palya)

Up/Down arrows support history navigation when using wildtrigger()

fixes: #18207
closes: #18219

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-06 19:47:45 +02:00
committed by Christian Brabandt
parent 8fec92d631
commit 708ab7f5fb
4 changed files with 46 additions and 8 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 02
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 06
VIM REFERENCE MANUAL by Bram Moolenaar
@ -12416,18 +12416,19 @@ wildtrigger() *wildtrigger()*
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: >
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 (up/down keys): >
cnoremap <Up> <C-U><Up>
cnoremap <Down> <C-U><Down>
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 set an option specifically when performing a search, e.g.
to set 'pumheight': >
To apply an option only during a search, for example to set
'pumheight': >
autocmd CmdlineEnter [/\?] set pumheight=8
autocmd CmdlineLeave [/\?] set pumheight&
<