patch 9.1.1742: complete: preinsert does not work well with preinsert
Problem: complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
(Girish Palya)
This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.
Try: `:set ac cot=preinsert`
See `:help 'cot'` for more details.
closes: #18213
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
4ed19fd336
commit
fa6fd41a94
@ -1,4 +1,4 @@
|
||||
*insert.txt* For Vim version 9.1. Last change: 2025 Aug 25
|
||||
*insert.txt* For Vim version 9.1. Last change: 2025 Sep 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -1150,7 +1150,26 @@ any of them at any time by typing |CTRL-X|, which temporarily suspends
|
||||
autocompletion. To use |i_CTRL-N| or |i_CTRL-X_CTRL-N| specifically, press
|
||||
|CTRL-E| first to dismiss the popup menu (see |complete_CTRL-E|).
|
||||
|
||||
See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'.
|
||||
*ins-autocompletion-example*
|
||||
Example setup~
|
||||
A typical configuration for automatic completion with a popup menu: >
|
||||
set autocomplete
|
||||
set complete=.^5,w^5,b^5,u^5
|
||||
set completeopt=popup
|
||||
|
||||
inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
<
|
||||
This enables automatic completion with suggestions from the current buffer,
|
||||
other windows, and listed buffers, displayed in a popup menu. Each source is
|
||||
limited to 5 candidates. <Tab> and <S-Tab> move through the items when the
|
||||
menu is visible. Optionally, add "preinsert" to 'completeopt' to insert the
|
||||
longest common prefix automatically. You can also add other completion
|
||||
sources to 'complete' as needed.
|
||||
|
||||
See also 'autocomplete', 'autocompletedelay' and 'autocompletetimeout'.
|
||||
|
||||
For command-line autocompletion, see |cmdline-autocompletion|.
|
||||
|
||||
|
||||
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
|
||||
|
||||
Reference in New Issue
Block a user