mirror of
https://github.com/neovim/neovim.git
synced 2026-04-24 00:05:36 +00:00
vim-patch:9.1.1576: cannot easily trigger wildcard expansion (#35022)
Problem: cannot easily trigger wildcard expansion
Solution: Introduce wildtrigger() function
(Girish Palya)
This PR introduces a new `wildtrigger()` function.
See `:h wildtrigger()`
`wildtrigger()` behaves like pressing the `wildchar,` but provides a
more refined and controlled completion experience:
- Suppresses beeps when no matches are found.
- Avoids displaying irrelevant completions (like full command lists)
when the prefix is insufficient or doesn't match.
- Skips completion if the typeahead buffer has pending input or if a
wildmenu is already active.
- Does not print "..." before completion.
This is an improvement on the `feedkeys()` based autocompletion script
given in vim/vim#16759.
closes: vim/vim#17806
b486ed8266
While at it, also make Ctrl-Z trigger search completion.
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
26
runtime/lua/vim/_meta/vimfn.lua
generated
26
runtime/lua/vim/_meta/vimfn.lua
generated
@@ -10813,6 +10813,32 @@ function vim.fn.wait(timeout, condition, interval) end
|
||||
--- @return any
|
||||
function vim.fn.wildmenumode() end
|
||||
|
||||
--- 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|.
|
||||
---
|
||||
--- 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>
|
||||
--- <
|
||||
--- Return value is always 0.
|
||||
---
|
||||
--- @return number
|
||||
function vim.fn.wildtrigger() end
|
||||
|
||||
--- Like `execute()` but in the context of window {id}.
|
||||
--- The window will temporarily be made the current window,
|
||||
--- without triggering autocommands or changing directory. When
|
||||
|
||||
Reference in New Issue
Block a user