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 @@
|
||||
*options.txt* For Vim version 9.1. Last change: 2025 Sep 02
|
||||
*options.txt* For Vim version 9.1. Last change: 2025 Sep 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -2124,10 +2124,11 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
*'complete'* *'cpt'* *E535*
|
||||
'complete' 'cpt' string (default: ".,w,b,u,t,i")
|
||||
local to buffer
|
||||
This option specifies how keyword completion |ins-completion| works
|
||||
when CTRL-P or CTRL-N are used. It is also used for whole-line
|
||||
completion |i_CTRL-X_CTRL-L|. It indicates the type of completion
|
||||
and the places to scan. It is a comma-separated list of flags:
|
||||
This option controls how completion |ins-completion| behaves when
|
||||
using CTRL-P, CTRL-N, or |ins-autocompletion|. It is also used for
|
||||
whole-line completion |i_CTRL-X_CTRL-L|. It indicates the type of
|
||||
completion and the places to scan. It is a comma-separated list of
|
||||
flags:
|
||||
. scan the current buffer ('wrapscan' is ignored)
|
||||
w scan buffers from other windows
|
||||
b scan other loaded buffers that are in the buffer list
|
||||
@ -2179,9 +2180,11 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
5. tags
|
||||
6. included files
|
||||
|
||||
As you can see, CTRL-N and CTRL-P can be used to do any 'iskeyword'-
|
||||
based expansion (e.g., dictionary |i_CTRL-X_CTRL-K|, included patterns
|
||||
|i_CTRL-X_CTRL-I|, tags |i_CTRL-X_CTRL-]| and normal expansions).
|
||||
CTRL-N, CTRL-P, and |ins-autocompletion| can be used for any
|
||||
'iskeyword'-based completion (dictionary |i_CTRL-X_CTRL-K|, included
|
||||
patterns |i_CTRL-X_CTRL-I|, tags |i_CTRL-X_CTRL-]|, and normal
|
||||
expansions). With the "F" and "o" flags in 'complete', non-keywords
|
||||
can also be completed.
|
||||
|
||||
An optional match limit can be specified for a completion source by
|
||||
appending a caret ("^") followed by a {count} to the source flag.
|
||||
@ -2298,17 +2301,22 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{only works when compiled with the |+textprop| feature}
|
||||
|
||||
preinsert
|
||||
Preinsert the portion of the first candidate word that is
|
||||
not part of the current completion leader and using the
|
||||
|hl-ComplMatchIns| highlight group. In order for it to
|
||||
work, "fuzzy" must not be set and "menuone" must be set.
|
||||
When autocompletion is not enabled, inserts the part of the
|
||||
first candidate word beyond the current completion leader,
|
||||
highlighted with |hl-ComplMatchIns|. The cursor does not
|
||||
move. Requires 'fuzzy' unset and 'menuone' in 'completeopt'.
|
||||
|
||||
When 'autocomplete' is enabled, inserts the longest common
|
||||
prefix of matches (from all shown items or buffer-specific
|
||||
matches), highlighted with |hl-PreInsert|. This occurs only
|
||||
when no menu item is selected. Press CTRL-Y to accept.
|
||||
|
||||
preview Show extra information about the currently selected
|
||||
completion in the preview window. Only works in
|
||||
combination with "menu" or "menuone".
|
||||
|
||||
Only "fuzzy", "popup", "popuphidden" and "preview" have an effect when
|
||||
'autocomplete' is enabled.
|
||||
Only "fuzzy", "popup", "popuphidden", "preinsert" and "preview" have
|
||||
an effect when 'autocomplete' is enabled.
|
||||
|
||||
This option does not apply to |cmdline-completion|. See 'wildoptions'
|
||||
for that.
|
||||
@ -4654,7 +4662,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
#:TabLineSel,_:TabLineFill,!:CursorColumn,
|
||||
.:CursorLine,o:ColorColumn,q:QuickFixLine,
|
||||
z:StatusLineTerm,Z:StatusLineTermNC,
|
||||
g:MsgArea,h:ComplMatchIns")
|
||||
g:MsgArea,h:ComplMatchIns,I:PreInsert")
|
||||
global
|
||||
This option can be used to set highlighting mode for various
|
||||
occasions. It is a comma-separated list of character pairs. The
|
||||
@ -4717,6 +4725,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|hl-PmenuThumb| X popup menu scrollbar thumb
|
||||
|hl-PmenuMatch| k popup menu matched text
|
||||
|hl-PmenuMatchSel| < popup menu matched text in selected line
|
||||
|hl-PreInsert| I text inserted when "preinsert" and 'autocomplete'
|
||||
|
||||
The display modes are:
|
||||
r reverse (termcap entry "mr" and "me")
|
||||
|
||||
Reference in New Issue
Block a user