-*insert.txt* For Vim version 9.1. Last change: 2025 Jul 21
+*insert.txt* For Vim version 9.1. Last change: 2025 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
CTRL-X CTRL-Z Stop completion without changing the text.
+AUTOCOMPLETION *ins-autocompletion*
+
+Vim can display a completion menu as you type, similar to using |i_CTRL-N|,
+but triggered automatically. See |'autocomplete'|. The menu items are
+collected from the sources listed in the |'complete'| option.
+
+Unlike manual |i_CTRL-N| completion, this mode uses a decaying timeout to keep
+Vim responsive. Sources earlier in the |'complete'| list are given more time
+(higher priority), but every source is guaranteed a time slice, however small.
+
+This mode is fully compatible with other completion modes. You can invoke
+any of them at any time by typing |CTRL-X|, which temporarily suspends
+autocompletion. To use |i_CTRL-N| specifically, press |CTRL-E| first to
+dismiss the popup menu (see |complete_CTRL-E|).
+
+
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
This applies to 'completefunc', 'thesaurusfunc' and 'omnifunc'.
-*options.txt* For Vim version 9.1. Last change: 2025 Jul 21
+*options.txt* For Vim version 9.1. Last change: 2025 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
the current directory won't change when navigating to it.
Note: When this option is on some plugins may not work.
+ *'autocomplete'* *'ac'* *'noautocomplete'* *'noac'*
+'autocomplete' 'ac' boolean (default off)
+ global
+ {only available on platforms with timing support}
+ When on, Vim shows a completion menu as you type, similar to using
+ |i_CTRL-N|, but triggered automatically. See |ins-autocompletion|.
+
*'autoindent'* *'ai'* *'noautoindent'* *'noai'*
'autoindent' 'ai' boolean (default off)
local to buffer
If the Dict returned by the {func} includes {"refresh": "always"},
the function will be invoked again whenever the leading text
changes.
- If generating matches is potentially slow, |complete_check()|
- should be used to avoid blocking and preserve editor
- responsiveness.
+ If generating matches is potentially slow, call
+ |complete_check()| periodically to keep Vim responsive. This
+ is especially important for |ins-autocompletion|.
F equivalent to using "F{func}", where the function is taken from
the 'completefunc' option.
o equivalent to using "F{func}", where the function is taken from
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.
+
This option does not apply to |cmdline-completion|. See 'wildoptions'
for that.
-*quickref.txt* For Vim version 9.1. Last change: 2025 Jul 16
+*quickref.txt* For Vim version 9.1. Last change: 2025 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
'arabic' 'arab' for Arabic as a default second language
'arabicshape' 'arshape' do shaping for Arabic characters
'autochdir' 'acd' change directory to the file in the current window
+'autocomplete' 'ac' automatic completion in insert mode
'autoindent' 'ai' take indent for new line from previous line
'autoread' 'ar' autom. read file when changed outside of Vim
'autoshelldir' 'asd' change directory to the shell's current directory
'] motion.txt /*']*
'^ motion.txt /*'^*
'a motion.txt /*'a*
+'ac' options.txt /*'ac'*
'acd' options.txt /*'acd'*
'ai' options.txt /*'ai'*
'akm' options.txt /*'akm'*
'as' todo.txt /*'as'*
'asd' options.txt /*'asd'*
'autochdir' options.txt /*'autochdir'*
+'autocomplete' options.txt /*'autocomplete'*
'autoindent' options.txt /*'autoindent'*
'autoprint' vi_diff.txt /*'autoprint'*
'autoread' options.txt /*'autoread'*
'mzschemedll' options.txt /*'mzschemedll'*
'mzschemegcdll' options.txt /*'mzschemegcdll'*
'nf' options.txt /*'nf'*
+'noac' options.txt /*'noac'*
'noacd' options.txt /*'noacd'*
'noai' options.txt /*'noai'*
'noakm' options.txt /*'noakm'*
'noas' todo.txt /*'noas'*
'noasd' options.txt /*'noasd'*
'noautochdir' options.txt /*'noautochdir'*
+'noautocomplete' options.txt /*'noautocomplete'*
'noautoindent' options.txt /*'noautoindent'*
'noautoread' options.txt /*'noautoread'*
'noautosave' todo.txt /*'noautosave'*
inputrestore() builtin.txt /*inputrestore()*
inputsave() builtin.txt /*inputsave()*
inputsecret() builtin.txt /*inputsecret()*
+ins-autocompletion insert.txt /*ins-autocompletion*
ins-completion insert.txt /*ins-completion*
ins-completion-menu insert.txt /*ins-completion-menu*
ins-expandtab insert.txt /*ins-expandtab*
-*version9.txt* For Vim version 9.1. Last change: 2025 Jul 21
+*version9.txt* For Vim version 9.1. Last change: 2025 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
"preinsert" - highlight to be inserted values
"nearest" - sort completion results by distance to cursor
- new function |wildtrigger()| to trigger wildcard expansion
+- Support for Autocompletion has been added |ins-autocompletion|
Platform specific~
-----------------
Options: ~
+'autocompletion' Enable auto completion |ins-autocompletion|
'chistory' Size of the quickfix stack |quickfix-stack|.
'completefuzzycollect' Enable fuzzy collection of candidates for (some)
|ins-completion| modes
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Jul 16
+" Last Change: 2025 Jul 25
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
if has("insert_expand")
call <SID>AddOption("complete", gettext("specifies how Insert mode completion works for CTRL-N and CTRL-P"))
call append("$", "\t" .. s:local_to_buffer)
- call <SID>OptionL("cfc")
- call <SID>AddOption("completefuzzycollect", gettext("use fuzzy collection for specific completion modes"))
call <SID>OptionL("cpt")
+ call <SID>AddOption("autocomplete", gettext("automatic completion in insert mode"))
+ call <SID>BinOptionG("ac", &ac)
call <SID>AddOption("completeopt", gettext("whether to use a popup menu for Insert mode completion"))
call <SID>OptionL("cot")
call <SID>AddOption("completeitemalign", gettext("popup menu item align order"))
call <SID>OptionG("cia", &cia)
+ call <SID>AddOption("completefuzzycollect", gettext("use fuzzy collection for specific completion modes"))
+ call <SID>OptionL("cfc")
if exists("+completepopup")
call <SID>AddOption("completepopup", gettext("options for the Insert mode completion info popup"))
call <SID>OptionG("cpp", &cpp)
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2025 Jul 24
+" Last Change: 2025 Jul 25
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
" vimOptions are caught only when contained in a vimSet {{{2
" GEN_SYN_VIM: vimOption normal, START_STR='syn keyword vimOption contained', END_STR='skipwhite nextgroup=vimSetEqual,vimSetMod'
-syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ai autoindent ar autoread asd autoshelldir aw autowrite awa autowriteall bg background bs backspace bk backup bkc backupcopy bdir backupdir bex backupext bsk backupskip bdlay balloondelay beval ballooneval bevalterm balloonevalterm bexpr balloonexpr bo belloff bin binary bomb brk breakat bri breakindent briopt breakindentopt bsdir browsedir bh bufhidden bl buflisted bt buftype cmp casemap cdh cdhome cd cdpath cedit ccv charconvert chi chistory cin cindent cink cinkeys cino cinoptions cinsd cinscopedecls cinw cinwords cb clipboard cpm clipmethod ch cmdheight cwh cmdwinheight cc colorcolumn co columns com comments cms commentstring cp compatible skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained cpt complete cfu completefunc cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dia diffanchors dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore eiw eventignorewin skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode ise isexpand isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth mmd maxmapdepth mm maxmem mmp maxmempattern skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont popt printoptions prompt ph pumheight pmw pummaxwidth skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ac autocomplete ai autoindent ar autoread asd autoshelldir aw autowrite awa autowriteall bg background bs backspace bk backup bkc backupcopy bdir backupdir bex backupext bsk backupskip bdlay balloondelay beval ballooneval bevalterm balloonevalterm bexpr balloonexpr bo belloff bin binary bomb brk breakat bri breakindent briopt breakindentopt bsdir browsedir bh bufhidden bl buflisted bt buftype cmp casemap cdh cdhome cd cdpath cedit ccv charconvert chi chistory cin cindent cink cinkeys cino cinoptions cinsd cinscopedecls cinw cinwords cb clipboard cpm clipmethod ch cmdheight cwh cmdwinheight cc colorcolumn co columns com comments cms commentstring skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained cp compatible cpt complete cfu completefunc cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dia diffanchors dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained eiw eventignorewin et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight hi history hk hkmap hkp hkmapp hls hlsearch skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode ise isexpand isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth mmd maxmapdepth mm maxmem skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained mmp maxmempattern mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont popt printoptions prompt ph pumheight skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes skipwhite nextgroup=vimSetEqual,vimSetMod
" vimOptions: These are the turn-off setting variants {{{2
" GEN_SYN_VIM: vimOption turn-off, START_STR='syn keyword vimOption contained', END_STR=''
-syn keyword vimOption contained noari noallowrevins noarab noarabic noarshape noarabicshape noacd noautochdir noai noautoindent noar noautoread noasd noautoshelldir noaw noautowrite noawa noautowriteall nobk nobackup nobeval noballooneval nobevalterm noballoonevalterm nobin nobinary nobomb nobri nobreakindent nobl nobuflisted nocdh nocdhome nocin nocindent nocp nocompatible nocf noconfirm noci nocopyindent nocsre nocscoperelative nocst nocscopetag nocsverb nocscopeverbose nocrb nocursorbind nocuc nocursorcolumn nocul nocursorline nodeco nodelcombine nodiff nodg nodigraph noed noedcompatible noemo noemoji noeof noendoffile noeol noendofline noea noequalalways noeb noerrorbells noek noesckeys noet noexpandtab noex noexrc nofic nofileignorecase nofixeol nofixendofline
-syn keyword vimOption contained nofen nofoldenable nofs nofsync nogd nogdefault noguipty nohid nohidden nohk nohkmap nohkp nohkmapp nohls nohlsearch noicon noic noignorecase noimc noimcmdline noimd noimdisable nois noincsearch noinf noinfercase noim noinsertmode nojs nojoinspaces nolnr nolangnoremap nolrm nolangremap nolz nolazyredraw nolbr nolinebreak nolisp nolist nolpl noloadplugins nomagic noml nomodeline nomle nomodelineexpr noma nomodifiable nomod nomodified nomore nomousef nomousefocus nomh nomousehide nomousemev nomousemoveevent nonu nonumber noodev noopendevice nopaste nopi nopreserveindent nopvw nopreviewwindow noprompt noro noreadonly nornu norelativenumber noremap nors norestorescreen nori norevins norl norightleft noru noruler noscb noscrollbind noscf noscrollfocus
-syn keyword vimOption contained nosecure nossl noshellslash nostmp noshelltemp nosr noshiftround nosn noshortname nosc noshowcmd nosft noshowfulltag nosm noshowmatch nosmd noshowmode noscs nosmartcase nosi nosmartindent nosta nosmarttab nosms nosmoothscroll nospell nosb nosplitbelow nospr nosplitright nosol nostartofline noswf noswapfile notbs notagbsearch notr notagrelative notgst notagstack notbidi notermbidi notgc notermguicolors noterse nota notextauto notx notextmode notop notildeop noto notimeout notitle nottimeout notbi nottybuiltin notf nottyfast noudf noundofile novb novisualbell nowarn nowiv noweirdinvert nowic nowildignorecase nowmnu nowildmenu nowfb nowinfixbuf nowfh nowinfixheight nowfw nowinfixwidth nowst nowlsteal nowrap nows nowrapscan nowrite
-syn keyword vimOption contained nowa nowriteany nowb nowritebackup noxtermcodes
+syn keyword vimOption contained noari noallowrevins noarab noarabic noarshape noarabicshape noacd noautochdir noac noautocomplete noai noautoindent noar noautoread noasd noautoshelldir noaw noautowrite noawa noautowriteall nobk nobackup nobeval noballooneval nobevalterm noballoonevalterm nobin nobinary nobomb nobri nobreakindent nobl nobuflisted nocdh nocdhome nocin nocindent nocp nocompatible nocf noconfirm noci nocopyindent nocsre nocscoperelative nocst nocscopetag nocsverb nocscopeverbose nocrb nocursorbind nocuc nocursorcolumn nocul nocursorline nodeco nodelcombine nodiff nodg nodigraph noed noedcompatible noemo noemoji noeof noendoffile noeol noendofline noea noequalalways noeb noerrorbells noek noesckeys noet noexpandtab noex noexrc nofic nofileignorecase
+syn keyword vimOption contained nofixeol nofixendofline nofen nofoldenable nofs nofsync nogd nogdefault noguipty nohid nohidden nohk nohkmap nohkp nohkmapp nohls nohlsearch noicon noic noignorecase noimc noimcmdline noimd noimdisable nois noincsearch noinf noinfercase noim noinsertmode nojs nojoinspaces nolnr nolangnoremap nolrm nolangremap nolz nolazyredraw nolbr nolinebreak nolisp nolist nolpl noloadplugins nomagic noml nomodeline nomle nomodelineexpr noma nomodifiable nomod nomodified nomore nomousef nomousefocus nomh nomousehide nomousemev nomousemoveevent nonu nonumber noodev noopendevice nopaste nopi nopreserveindent nopvw nopreviewwindow noprompt noro noreadonly nornu norelativenumber noremap nors norestorescreen nori norevins norl norightleft noru noruler
+syn keyword vimOption contained noscb noscrollbind noscf noscrollfocus nosecure nossl noshellslash nostmp noshelltemp nosr noshiftround nosn noshortname nosc noshowcmd nosft noshowfulltag nosm noshowmatch nosmd noshowmode noscs nosmartcase nosi nosmartindent nosta nosmarttab nosms nosmoothscroll nospell nosb nosplitbelow nospr nosplitright nosol nostartofline noswf noswapfile notbs notagbsearch notr notagrelative notgst notagstack notbidi notermbidi notgc notermguicolors noterse nota notextauto notx notextmode notop notildeop noto notimeout notitle nottimeout notbi nottybuiltin notf nottyfast noudf noundofile novb novisualbell nowarn nowiv noweirdinvert nowic nowildignorecase nowmnu nowildmenu nowfb nowinfixbuf nowfh nowinfixheight nowfw nowinfixwidth nowst nowlsteal
+syn keyword vimOption contained nowrap nows nowrapscan nowrite nowa nowriteany nowb nowritebackup noxtermcodes
" vimOptions: These are the invertible variants {{{2
" GEN_SYN_VIM: vimOption invertible, START_STR='syn keyword vimOption contained', END_STR=''
-syn keyword vimOption contained invari invallowrevins invarab invarabic invarshape invarabicshape invacd invautochdir invai invautoindent invar invautoread invasd invautoshelldir invaw invautowrite invawa invautowriteall invbk invbackup invbeval invballooneval invbevalterm invballoonevalterm invbin invbinary invbomb invbri invbreakindent invbl invbuflisted invcdh invcdhome invcin invcindent invcp invcompatible invcf invconfirm invci invcopyindent invcsre invcscoperelative invcst invcscopetag invcsverb invcscopeverbose invcrb invcursorbind invcuc invcursorcolumn invcul invcursorline invdeco invdelcombine invdiff invdg invdigraph inved invedcompatible invemo invemoji inveof invendoffile inveol invendofline invea invequalalways inveb inverrorbells invek invesckeys
-syn keyword vimOption contained invet invexpandtab invex invexrc invfic invfileignorecase invfixeol invfixendofline invfen invfoldenable invfs invfsync invgd invgdefault invguipty invhid invhidden invhk invhkmap invhkp invhkmapp invhls invhlsearch invicon invic invignorecase invimc invimcmdline invimd invimdisable invis invincsearch invinf invinfercase invim invinsertmode invjs invjoinspaces invlnr invlangnoremap invlrm invlangremap invlz invlazyredraw invlbr invlinebreak invlisp invlist invlpl invloadplugins invmagic invml invmodeline invmle invmodelineexpr invma invmodifiable invmod invmodified invmore invmousef invmousefocus invmh invmousehide invmousemev invmousemoveevent invnu invnumber invodev invopendevice invpaste invpi invpreserveindent invpvw invpreviewwindow
-syn keyword vimOption contained invprompt invro invreadonly invrnu invrelativenumber invremap invrs invrestorescreen invri invrevins invrl invrightleft invru invruler invscb invscrollbind invscf invscrollfocus invsecure invssl invshellslash invstmp invshelltemp invsr invshiftround invsn invshortname invsc invshowcmd invsft invshowfulltag invsm invshowmatch invsmd invshowmode invscs invsmartcase invsi invsmartindent invsta invsmarttab invsms invsmoothscroll invspell invsb invsplitbelow invspr invsplitright invsol invstartofline invswf invswapfile invtbs invtagbsearch invtr invtagrelative invtgst invtagstack invtbidi invtermbidi invtgc invtermguicolors invterse invta invtextauto invtx invtextmode invtop invtildeop invto invtimeout invtitle invttimeout invtbi invttybuiltin
-syn keyword vimOption contained invtf invttyfast invudf invundofile invvb invvisualbell invwarn invwiv invweirdinvert invwic invwildignorecase invwmnu invwildmenu invwfb invwinfixbuf invwfh invwinfixheight invwfw invwinfixwidth invwst invwlsteal invwrap invws invwrapscan invwrite invwa invwriteany invwb invwritebackup invxtermcodes
+syn keyword vimOption contained invari invallowrevins invarab invarabic invarshape invarabicshape invacd invautochdir invac invautocomplete invai invautoindent invar invautoread invasd invautoshelldir invaw invautowrite invawa invautowriteall invbk invbackup invbeval invballooneval invbevalterm invballoonevalterm invbin invbinary invbomb invbri invbreakindent invbl invbuflisted invcdh invcdhome invcin invcindent invcp invcompatible invcf invconfirm invci invcopyindent invcsre invcscoperelative invcst invcscopetag invcsverb invcscopeverbose invcrb invcursorbind invcuc invcursorcolumn invcul invcursorline invdeco invdelcombine invdiff invdg invdigraph inved invedcompatible invemo invemoji inveof invendoffile inveol invendofline invea invequalalways inveb inverrorbells
+syn keyword vimOption contained invek invesckeys invet invexpandtab invex invexrc invfic invfileignorecase invfixeol invfixendofline invfen invfoldenable invfs invfsync invgd invgdefault invguipty invhid invhidden invhk invhkmap invhkp invhkmapp invhls invhlsearch invicon invic invignorecase invimc invimcmdline invimd invimdisable invis invincsearch invinf invinfercase invim invinsertmode invjs invjoinspaces invlnr invlangnoremap invlrm invlangremap invlz invlazyredraw invlbr invlinebreak invlisp invlist invlpl invloadplugins invmagic invml invmodeline invmle invmodelineexpr invma invmodifiable invmod invmodified invmore invmousef invmousefocus invmh invmousehide invmousemev invmousemoveevent invnu invnumber invodev invopendevice invpaste invpi invpreserveindent
+syn keyword vimOption contained invpvw invpreviewwindow invprompt invro invreadonly invrnu invrelativenumber invremap invrs invrestorescreen invri invrevins invrl invrightleft invru invruler invscb invscrollbind invscf invscrollfocus invsecure invssl invshellslash invstmp invshelltemp invsr invshiftround invsn invshortname invsc invshowcmd invsft invshowfulltag invsm invshowmatch invsmd invshowmode invscs invsmartcase invsi invsmartindent invsta invsmarttab invsms invsmoothscroll invspell invsb invsplitbelow invspr invsplitright invsol invstartofline invswf invswapfile invtbs invtagbsearch invtr invtagrelative invtgst invtagstack invtbidi invtermbidi invtgc invtermguicolors invterse invta invtextauto invtx invtextmode invtop invtildeop invto invtimeout invtitle
+syn keyword vimOption contained invttimeout invtbi invttybuiltin invtf invttyfast invudf invundofile invvb invvisualbell invwarn invwiv invweirdinvert invwic invwildignorecase invwmnu invwildmenu invwfb invwinfixbuf invwfh invwinfixheight invwfw invwinfixwidth invwst invwlsteal invwrap invws invwrapscan invwrite invwa invwriteany invwb invwritebackup invxtermcodes
" termcap codes (which can also be set) {{{2
" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='skipwhite nextgroup=vimSetEqual,vimSetMod'
syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u t_xo skipwhite nextgroup=vimSetEqual,vimSetMod
" vimOptions: These are the variable names {{{2
" GEN_SYN_VIM: vimOption normal variable, START_STR='syn keyword vimOptionVarName contained', END_STR=''
-syn keyword vimOptionVarName contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ai autoindent ar autoread asd autoshelldir aw autowrite awa autowriteall bg background bs backspace bk backup bkc backupcopy bdir backupdir bex backupext bsk backupskip bdlay balloondelay beval ballooneval bevalterm balloonevalterm bexpr balloonexpr bo belloff bin binary bomb brk breakat bri breakindent briopt breakindentopt bsdir browsedir bh bufhidden bl buflisted bt buftype cmp casemap cdh cdhome cd cdpath cedit ccv charconvert chi chistory cin cindent cink cinkeys cino cinoptions cinsd cinscopedecls cinw cinwords cb clipboard cpm clipmethod ch cmdheight cwh cmdwinheight cc colorcolumn co columns com comments cms commentstring cp compatible
-syn keyword vimOptionVarName contained cpt complete cfu completefunc cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dia diffanchors dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore eiw eventignorewin
-syn keyword vimOptionVarName contained et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring
-syn keyword vimOptionVarName contained ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode ise isexpand isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth mmd maxmapdepth mm maxmem mmp maxmempattern
-syn keyword vimOptionVarName contained mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont popt printoptions prompt ph pumheight pmw pummaxwidth
-syn keyword vimOptionVarName contained pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch
-syn keyword vimOptionVarName contained smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto
-syn keyword vimOptionVarName contained tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight
-syn keyword vimOptionVarName contained wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes
+syn keyword vimOptionVarName contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ac autocomplete ai autoindent ar autoread asd autoshelldir aw autowrite awa autowriteall bg background bs backspace bk backup bkc backupcopy bdir backupdir bex backupext bsk backupskip bdlay balloondelay beval ballooneval bevalterm balloonevalterm bexpr balloonexpr bo belloff bin binary bomb brk breakat bri breakindent briopt breakindentopt bsdir browsedir bh bufhidden bl buflisted bt buftype cmp casemap cdh cdhome cd cdpath cedit ccv charconvert chi chistory cin cindent cink cinkeys cino cinoptions cinsd cinscopedecls cinw cinwords cb clipboard cpm clipmethod ch cmdheight cwh cmdwinheight cc colorcolumn co columns com comments cms commentstring
+syn keyword vimOptionVarName contained cp compatible cpt complete cfu completefunc cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dia diffanchors dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore
+syn keyword vimOptionVarName contained eiw eventignorewin et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight hi history hk hkmap hkp hkmapp hls hlsearch
+syn keyword vimOptionVarName contained icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode ise isexpand isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth mmd maxmapdepth
+syn keyword vimOptionVarName contained mm maxmem mmp maxmempattern mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont popt printoptions prompt
+syn keyword vimOptionVarName contained ph pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc
+syn keyword vimOptionVarName contained sft showfulltag sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors twk termwinkey twsl termwinscroll tws termwinsize
+syn keyword vimOptionVarName contained twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth
+syn keyword vimOptionVarName contained wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes
" GEN_SYN_VIM: vimOption term output code variable, START_STR='syn keyword vimOptionVarName contained', END_STR=''
syn keyword vimOptionVarName contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u t_xo
syn keyword vimOptionVarName contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku
case Ctrl_H:
did_backspace = ins_bs(c, BACKSPACE_CHAR, &inserted_space);
auto_format(FALSE, TRUE);
+ if (did_backspace && p_ac && !char_avail()
+ && curwin->w_cursor.col > 0)
+ {
+ c = char_before_cursor();
+ if (ins_compl_setup_autocompl(c))
+ {
+ update_screen(UPD_VALID); // Show char deletion immediately
+ out_flush();
+ goto docomplete; // Trigger autocompletion
+ }
+ }
break;
case Ctrl_W: // delete word before the cursor
// closed fold.
foldOpenCursor();
#endif
+ // Trigger autocompletion
+ if (p_ac && !char_avail() && ins_compl_setup_autocompl(c))
+ {
+ update_screen(UPD_VALID); // Show character immediately
+ out_flush();
+ goto docomplete;
+ }
+
break;
} // end of switch (c)
if ( !ISSPECIAL(c)
&& (!has_mbyte || (*mb_char2len)(c) == 1)
&& !has_insertcharpre()
+#ifdef FEAT_EVAL
+ // Skip typeahead if test_override("char_avail", 1) was called.
+ && !disable_char_avail_for_testing
+#endif
&& vpeekc() != NUL
&& !(State & REPLACE_FLAG)
&& !cindent_on()
static win_T *compl_curr_win = NULL; // win where completion is active
static buf_T *compl_curr_buf = NULL; // buf where completion is active
+#define COMPL_INITIAL_TIMEOUT_MS 80
+// Autocomplete uses a decaying timeout: starting from COMPL_INITIAL_TIMEOUT_MS,
+// if the current source exceeds its timeout, it is interrupted and the next
+// begins with half the time. A small minimum timeout ensures every source
+// gets at least a brief chance.
+static int compl_autocomplete = FALSE; // whether autocompletion is active
+static int compl_timeout_ms = COMPL_INITIAL_TIMEOUT_MS;
+static int compl_time_slice_expired = FALSE; // time budget exceeded for current source
+static int compl_from_nonkeyword = FALSE; // completion started from non-keyword
+
+// Halve the current completion timeout, simulating exponential decay.
+#define COMPL_MIN_TIMEOUT_MS 5
+#define DECAY_COMPL_TIMEOUT() \
+ do { \
+ if (compl_timeout_ms > COMPL_MIN_TIMEOUT_MS) \
+ compl_timeout_ms /= 2; \
+ } while (0)
+
// List of flags for method of completion.
static int compl_cont_status = 0;
# define CONT_ADDING 1 // "normal" or "adding" expansion
int cs_refresh_always; // Whether 'refresh:always' is set for func
int cs_startcol; // Start column returned by func
int cs_max_matches; // Max items to display from this source
+#ifdef ELAPSED_FUNC
+ elapsed_T compl_start_tv; // Timestamp when match collection starts
+#endif
} cpt_source_T;
#define STARTCOL_NONE -9
if (!ctrl_x_mode_cmdline())
{
// if the next ^X<> won't ADD nothing, then reset compl_cont_status
- if (compl_cont_status & CONT_N_ADDS)
+ if ((compl_cont_status & CONT_N_ADDS) && !p_ac)
compl_cont_status |= CONT_INTRPT;
else
compl_cont_status = 0;
int
ins_compl_accept_char(int c)
{
+ if (compl_autocomplete && compl_from_nonkeyword)
+ return FALSE;
+
if (ctrl_x_mode & CTRL_X_WANT_IDENT)
// When expanding an identifier only accept identifier chars.
return vim_isIDc(c);
static int
is_nearest_active(void)
{
- return (get_cot_flags() & (COT_NEAREST | COT_FUZZY)) == COT_NEAREST;
+ int flags = get_cot_flags();
+ return (compl_autocomplete || (flags & COT_NEAREST))
+ && !(flags & COT_FUZZY);
}
/*
pum_wanted(void)
{
// 'completeopt' must contain "menu" or "menuone"
- if ((get_cot_flags() & COT_ANY_MENU) == 0)
+ if ((get_cot_flags() & COT_ANY_MENU) == 0 && !compl_autocomplete)
return FALSE;
// The display looks bad on a B&W display.
compl = compl->cp_next;
} while (!is_first_match(compl));
- if (get_cot_flags() & COT_MENUONE)
+ if ((get_cot_flags() & COT_MENUONE) || compl_autocomplete)
return (i >= 1);
return (i >= 2);
}
int i = 0;
int cur = -1;
unsigned int cur_cot_flags = get_cot_flags();
- int compl_no_select = (cur_cot_flags & COT_NOSELECT) != 0;
+ int compl_no_select = (cur_cot_flags & COT_NOSELECT) != 0
+ || compl_autocomplete;
int fuzzy_filter = (cur_cot_flags & COT_FUZZY) != 0;
compl_T *match_head = NULL;
compl_T *match_tail = NULL;
leader_len = (int)ins_compl_leader_len();
}
- for (i = 0; i < count && !got_int && !compl_interrupted; i++)
+ for (i = 0; i < count && !got_int && !compl_interrupted
+ && !compl_time_slice_expired; i++)
{
fp = mch_fopen((char *)files[i], "r"); // open dictionary file
- if (flags != DICT_EXACT && !shortmess(SHM_COMPLETIONSCAN))
+ if (flags != DICT_EXACT && !shortmess(SHM_COMPLETIONSCAN)
+ && !compl_autocomplete)
{
msg_hist_off = TRUE; // reset in msg_trunc_attr()
vim_snprintf((char *)IObuff, IOSIZE,
// Read dictionary file line by line.
// Check each line for a match.
- while (!got_int && !compl_interrupted && !vim_fgets(buf, LSIZE, fp))
+ while (!got_int && !compl_interrupted && !compl_time_slice_expired
+ && !vim_fgets(buf, LSIZE, fp))
{
ptr = buf;
if (regmatch != NULL)
VIM_CLEAR_STRING(compl_orig_text);
compl_enter_selects = FALSE;
cpt_sources_clear();
+ compl_autocomplete = FALSE;
+ compl_from_nonkeyword = FALSE;
+ compl_num_bests = 0;
#ifdef FEAT_EVAL
// clear v:completed_item
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
{
int cur_cot_flags = get_cot_flags();
return (cur_cot_flags & (COT_PREINSERT | COT_FUZZY | COT_MENUONE))
- == (COT_PREINSERT | COT_MENUONE);
+ == (COT_PREINSERT | COT_MENUONE) && !compl_autocomplete;
}
/*
save_w_wrow = curwin->w_wrow;
save_w_leftcol = curwin->w_leftcol;
compl_restarting = TRUE;
+ if (p_ac)
+ compl_autocomplete = TRUE;
if (ins_complete(Ctrl_N, FALSE) == FAIL)
compl_cont_status = 0;
compl_restarting = FALSE;
compl_cont_status = 0;
compl_cont_mode = 0;
cpt_sources_clear();
+ compl_autocomplete = FALSE;
+ compl_from_nonkeyword = FALSE;
+ compl_num_bests = 0;
}
/*
edit_submode = NULL;
showmode();
}
+ compl_autocomplete = FALSE;
+ compl_from_nonkeyword = FALSE;
+ compl_best_matches = 0;
if (c == Ctrl_C && cmdwin_type != 0)
// Avoid the popup menu remains displayed when leaving the
RedrawingDisabled = 0;
ins_compl_check_keys(0, TRUE);
- rettv->vval.v_number = ins_compl_interrupted();
+ if (compl_autocomplete && compl_time_slice_expired)
+ rettv->vval.v_number = TRUE;
+ else
+ rettv->vval.v_number = ins_compl_interrupted();
RedrawingDisabled = save_RedrawingDisabled;
}
{
int compl_type = -1;
int status = INS_COMPL_CPT_OK;
+ int skip_source = compl_autocomplete && compl_from_nonkeyword;
st->found_all = FALSE;
*advance_cpt_idx = FALSE;
while (*st->e_cpt == ',' || *st->e_cpt == ' ')
st->e_cpt++;
- if (*st->e_cpt == '.' && !curbuf->b_scanned)
+ if (*st->e_cpt == '.' && !curbuf->b_scanned && !skip_source
+ && !compl_time_slice_expired)
{
st->ins_buf = curbuf;
st->first_match_pos = *start_match_pos;
// wrap and come back there a second time.
st->set_match_pos = TRUE;
}
- else if (vim_strchr((char_u *)"buwU", *st->e_cpt) != NULL
+ else if (!skip_source && !compl_time_slice_expired
+ && vim_strchr((char_u *)"buwU", *st->e_cpt) != NULL
&& (st->ins_buf = ins_compl_next_buf(
st->ins_buf, *st->e_cpt)) != curbuf)
{
st->dict = st->ins_buf->b_fname;
st->dict_f = DICT_EXACT;
}
- if (!shortmess(SHM_COMPLETIONSCAN))
+ if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete)
{
msg_hist_off = TRUE; // reset in msg_trunc_attr()
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
{
if (ctrl_x_mode_line_or_eval())
compl_type = -1;
- else if (*st->e_cpt == 'k' || *st->e_cpt == 's')
- {
- if (*st->e_cpt == 'k')
- compl_type = CTRL_X_DICTIONARY;
- else
- compl_type = CTRL_X_THESAURUS;
- if (*++st->e_cpt != ',' && *st->e_cpt != NUL)
- {
- st->dict = st->e_cpt;
- st->dict_f = DICT_FIRST;
- }
- }
#ifdef FEAT_COMPL_FUNC
else if (*st->e_cpt == 'F' || *st->e_cpt == 'o')
{
compl_type = -1;
}
#endif
+ else if (!skip_source)
+ {
+ if (*st->e_cpt == 'k' || *st->e_cpt == 's')
+ {
+ if (*st->e_cpt == 'k')
+ compl_type = CTRL_X_DICTIONARY;
+ else
+ compl_type = CTRL_X_THESAURUS;
+ if (*++st->e_cpt != ',' && *st->e_cpt != NUL)
+ {
+ st->dict = st->e_cpt;
+ st->dict_f = DICT_FIRST;
+ }
+ }
#ifdef FEAT_FIND_ID
- else if (*st->e_cpt == 'i')
- compl_type = CTRL_X_PATH_PATTERNS;
- else if (*st->e_cpt == 'd')
- compl_type = CTRL_X_PATH_DEFINES;
+ else if (*st->e_cpt == 'i')
+ compl_type = CTRL_X_PATH_PATTERNS;
+ else if (*st->e_cpt == 'd')
+ compl_type = CTRL_X_PATH_DEFINES;
#endif
- else if (*st->e_cpt == ']' || *st->e_cpt == 't')
- {
- compl_type = CTRL_X_TAGS;
- if (!shortmess(SHM_COMPLETIONSCAN))
+ else if (*st->e_cpt == ']' || *st->e_cpt == 't')
{
- msg_hist_off = TRUE; // reset in msg_trunc_attr()
- vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
- (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
+ compl_type = CTRL_X_TAGS;
+ if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete)
+ {
+ msg_hist_off = TRUE; // reset in msg_trunc_attr()
+ vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
+ (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
+ }
}
+ else
+ compl_type = -1;
}
- else
- compl_type = -1;
// in any case e_cpt is advanced to the next entry
(void)copy_option_part(&st->e_cpt, IObuff, IOSIZE, ",");
int looped_around = FALSE;
char_u *ptr = NULL;
int len = 0;
- int in_collect = (cfc_has_mode() && compl_length > 0);
+ int in_fuzzy_collect = (cfc_has_mode() && compl_length > 0)
+ || ((get_cot_flags() & COT_FUZZY) && compl_autocomplete);
char_u *leader = ins_compl_leader();
int score = 0;
int in_curbuf = st->ins_buf == curbuf;
++msg_silent; // Don't want messages for wrapscan.
- if (in_collect)
+ if (in_fuzzy_collect)
{
found_new_match = search_for_fuzzy_match(st->ins_buf,
st->cur_match_pos, leader, compl_direction,
&& start_pos->col == st->cur_match_pos->col)
continue;
- if (!in_collect)
+ if (!in_fuzzy_collect)
ptr = ins_compl_get_next_word_or_line(st->ins_buf, st->cur_match_pos,
&len, &cont_s_ipos);
if (ptr == NULL || (ins_compl_has_preinsert() && STRCMP(ptr, compl_pattern.string) == 0))
in_curbuf ? NULL : st->ins_buf->b_sfname,
0, cont_s_ipos, score) != NOTDONE)
{
- if (in_collect && score == compl_first_match->cp_next->cp_score)
+ if (in_fuzzy_collect && score == compl_first_match->cp_next->cp_score)
compl_num_bests++;
found_new_match = OK;
break;
return FAIL;
}
+/*
+ * Start the timer for the current completion source.
+ */
+ static void
+compl_source_start_timer(int source_idx UNUSED)
+{
+#ifdef ELAPSED_FUNC
+ if (compl_autocomplete && cpt_sources_array != NULL)
+ {
+ ELAPSED_INIT(cpt_sources_array[source_idx].compl_start_tv);
+ compl_time_slice_expired = FALSE;
+ }
+#endif
+}
+
/*
* Safely advance the cpt_sources_index by one.
*/
return FAIL;
}
+#define COMPL_FUNC_TIMEOUT_MS 300
+#define COMPL_FUNC_TIMEOUT_NON_KW_MS 1000
/*
* Get the next expansion(s), using "compl_pattern".
* The search starts at position "ini" in curbuf and in the direction
int found_new_match;
int type = ctrl_x_mode;
int may_advance_cpt_idx = FALSE;
+ pos_T start_pos = *ini;
if (!compl_started)
{
? (char_u *)"." : curbuf->b_p_cpt);
strip_caret_numbers_in_place(st.e_cpt_copy);
st.e_cpt = st.e_cpt_copy == NULL ? (char_u *)"" : st.e_cpt_copy;
- st.last_match_pos = st.first_match_pos = *ini;
+
+ // In large buffers, timeout may miss nearby matches — search above cursor
+#define LOOKBACK_LINE_COUNT 1000
+ if (compl_autocomplete && is_nearest_active())
+ {
+ start_pos.lnum = MAX(1, start_pos.lnum - LOOKBACK_LINE_COUNT);
+ start_pos.col = 0;
+ }
+ st.last_match_pos = st.first_match_pos = start_pos;
}
else if (st.ins_buf != curbuf && !buf_valid(st.ins_buf))
st.ins_buf = curbuf; // In case the buffer was wiped out.
if (cpt_sources_array != NULL && ctrl_x_mode_normal()
&& !ctrl_x_mode_line_or_eval()
&& !(compl_cont_status & CONT_LOCAL))
+ {
cpt_sources_index = 0;
+ if (compl_autocomplete)
+ {
+ compl_source_start_timer(0);
+ compl_timeout_ms = COMPL_INITIAL_TIMEOUT_MS;
+ }
+ }
// For ^N/^P loop over all the flags/windows/buffers in 'complete'.
for (;;)
if ((ctrl_x_mode_normal() || ctrl_x_mode_line_or_eval())
&& (!compl_started || st.found_all))
{
- int status = process_next_cpt_value(&st, &type, ini,
+ int status = process_next_cpt_value(&st, &type, &start_pos,
cfc_has_mode(), &may_advance_cpt_idx);
if (status == INS_COMPL_CPT_END)
break;
if (status == INS_COMPL_CPT_CONT)
{
- if (may_advance_cpt_idx && !advance_cpt_sources_index_safe())
- break;
+ if (may_advance_cpt_idx)
+ {
+ if (!advance_cpt_sources_index_safe())
+ break;
+ compl_source_start_timer(cpt_sources_index);
+ }
continue;
}
}
if (compl_pattern.string == NULL)
break;
+ if (compl_autocomplete && type == CTRL_X_FUNCTION)
+ // LSP servers may sporadically take >1s to respond (e.g., while
+ // loading modules), but other sources might already have matches.
+ // To show results quickly use a short timeout for keyword
+ // completion. Allow longer timeout for non-keyword completion
+ // where only function based sources (e.g. LSP) are active.
+ compl_timeout_ms = compl_from_nonkeyword
+ ? COMPL_FUNC_TIMEOUT_NON_KW_MS : COMPL_FUNC_TIMEOUT_MS;
+
// get the next set of completion matches
- found_new_match = get_next_completion_match(type, &st, ini);
+ found_new_match = get_next_completion_match(type, &st, &start_pos);
- if (may_advance_cpt_idx && !advance_cpt_sources_index_safe())
- break;
+ if (may_advance_cpt_idx)
+ {
+ if (!advance_cpt_sources_index_safe())
+ break;
+ compl_source_start_timer(cpt_sources_index);
+ }
// break the loop for specialized modes (use 'complete' just for the
// generic ctrl_x_mode == CTRL_X_NORMAL) or when we've found a new
if ((ctrl_x_mode_not_default()
&& !ctrl_x_mode_line_or_eval()) || compl_interrupted)
break;
- compl_started = TRUE;
+ compl_started = compl_time_slice_expired ? FALSE : TRUE;
}
else
{
compl_started = FALSE;
}
+ // Reset the timeout after collecting matches from function source
+ if (compl_autocomplete && type == CTRL_X_FUNCTION)
+ compl_timeout_ms = COMPL_INITIAL_TIMEOUT_MS;
+
// For `^P` completion, reset `compl_curr_match` to the head to avoid
// mixing matches from different sources.
if (!compl_dir_forward())
i = -1; // total of matches, unknown
if (found_new_match == FAIL || (ctrl_x_mode_not_default()
- && !ctrl_x_mode_line_or_eval()))
+ && !ctrl_x_mode_line_or_eval()))
i = ins_compl_make_cyclic();
if (cfc_has_mode() && compl_get_longest && compl_num_bests > 0)
int found_end = FALSE;
compl_T *found_compl = NULL;
unsigned int cur_cot_flags = get_cot_flags();
- int compl_no_select = (cur_cot_flags & COT_NOSELECT) != 0;
+ int compl_no_select = (cur_cot_flags & COT_NOSELECT) != 0
+ || compl_autocomplete;
int compl_fuzzy_match = (cur_cot_flags & COT_FUZZY) != 0;
string_T *leader;
int started = compl_started;
buf_T *orig_curbuf = curbuf;
unsigned int cur_cot_flags = get_cot_flags();
- int compl_no_insert = (cur_cot_flags & COT_NOINSERT) != 0;
+ int compl_no_insert = (cur_cot_flags & COT_NOINSERT) != 0
+ || compl_autocomplete;
int compl_fuzzy_match = (cur_cot_flags & COT_FUZZY) != 0;
int compl_preinsert = ins_compl_has_preinsert();
// Enter will select a match when the match wasn't inserted and the popup
// menu is visible.
- if (compl_no_insert && !started)
+ if (compl_no_insert && !started && compl_selected_item != -1)
compl_enter_selects = TRUE;
else
compl_enter_selects = !insert_match && compl_match_array != NULL;
return num_matches;
}
+/*
+ * Check if the current completion source exceeded its timeout. If so, stop
+ * collecting, and halve the timeout.
+ */
+ static void
+check_elapsed_time(void)
+{
+#ifdef ELAPSED_FUNC
+ if (cpt_sources_array == NULL)
+ return;
+
+ elapsed_T *start_tv
+ = &cpt_sources_array[cpt_sources_index].compl_start_tv;
+ long elapsed_ms = ELAPSED_FUNC(*start_tv);
+
+ if (elapsed_ms > compl_timeout_ms)
+ {
+ compl_time_slice_expired = TRUE;
+ DECAY_COMPL_TIMEOUT();
+ }
+#endif
+}
+
/*
* Call this while finding completions, to check whether the user has hit a key
* that should change the currently displayed completion, or exit completion
}
}
}
- if (compl_pending != 0 && !got_int && !(cot_flags & COT_NOINSERT))
+ else if (compl_autocomplete)
+ check_elapsed_time();
+
+ if (compl_pending != 0 && !got_int && !(cot_flags & COT_NOINSERT)
+ && !compl_autocomplete)
{
+ // Insert the first match immediately and advance compl_shown_match,
+ // before finding other matches.
int todo = compl_pending > 0 ? compl_pending : -compl_pending;
compl_pending = 0;
compl_pattern.length = len;
compl_col += curs_col;
compl_length = 0;
+ compl_from_nonkeyword = TRUE;
}
else
{
compl_startpos.col = compl_col;
}
- if (!shortmess(SHM_COMPLETIONMENU))
+ if (!shortmess(SHM_COMPLETIONMENU) && !compl_autocomplete)
{
if (compl_cont_status & CONT_LOCAL)
edit_submode = (char_u *)_(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
// showmode might reset the internal line pointers, so it must
// be called before line = ml_get(), or when this address is no
// longer needed. -- Acevedo.
- if (!shortmess(SHM_COMPLETIONMENU))
+ if (!shortmess(SHM_COMPLETIONMENU) && !compl_autocomplete)
{
edit_submode_extra = (char_u *)_("-- Searching...");
edit_submode_highl = HLF_COUNT;
else
compl_cont_status &= ~CONT_S_IPOS;
- if (!shortmess(SHM_COMPLETIONMENU))
+ if (!shortmess(SHM_COMPLETIONMENU) && !compl_autocomplete)
ins_compl_show_statusmsg();
// Show the popup menu, unless we got interrupted.
return OK;
}
+/*
+ * Returns TRUE if the given character 'c' can be used to trigger
+ * autocompletion.
+ */
+ int
+ins_compl_setup_autocompl(int c)
+{
+#ifdef ELAPSED_FUNC
+ if (vim_isprintc(c))
+ {
+ compl_autocomplete = TRUE;
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
/*
* Remove (if needed) and show the popup menu
*/
if (set_compl_globals(startcol, curwin->w_cursor.col, TRUE) == OK)
{
expand_by_function(0, cpt_compl_pattern.string, cb);
+
cpt_sources_array[cpt_sources_index].cs_refresh_always =
compl_opt_refresh_always;
compl_opt_refresh_always = FALSE;
}
cpt_sources_array[cpt_sources_index].cs_startcol = startcol;
if (ret == OK)
+ {
+ compl_source_start_timer(cpt_sources_index);
get_cpt_func_completion_matches(cb);
+ }
}
else
cpt_sources_array[cpt_sources_index].cs_startcol
return (int)*ml_get_cursor();
}
+/*
+ * Return the character immediately before the cursor.
+ */
+ int
+char_before_cursor(void)
+{
+ if (curwin->w_cursor.col == 0)
+ return -1;
+
+ char_u *line = ml_get_curline();
+
+ if (has_mbyte)
+ {
+ char_u *p = line + curwin->w_cursor.col;
+ int prev_len = (*mb_head_off)(line, p - 1) + 1;
+ return mb_ptr2char(p - prev_len);
+ }
+ return line[curwin->w_cursor.col - 1];
+}
+
/*
* Write a character at the current cursor position.
* It is directly written into the block.
EXTERN unsigned cia_flags; // order flags of 'completeitemalign'
EXTERN char_u *p_cot; // 'completeopt'
EXTERN unsigned cot_flags; // flags from 'completeopt'
+EXTERN int p_ac; // 'autocomplete'
// Keep in sync with p_cot_values in optionstr.c
#define COT_MENU 0x001
#define COT_MENUONE 0x002
{(char_u *)0L, (char_u *)0L}
#endif
SCTX_INIT},
+#ifdef ELAPSED_FUNC
+ {"autocomplete", "ac", P_BOOL|P_VI_DEF,
+ (char_u *)&p_ac, PV_NONE, NULL,
+ NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
+#endif
{"autoindent", "ai", P_BOOL|P_VI_DEF,
(char_u *)&p_ai, PV_AI, NULL, NULL,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2025-07-24 19:13+0200\n"
+"POT-Creation-Date: 2025-07-25 18:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "specifies how Insert mode completion works for CTRL-N and CTRL-P"
msgstr ""
-msgid "use fuzzy collection for specific completion modes"
+msgid "automatic completion in insert mode"
msgstr ""
msgid "whether to use a popup menu for Insert mode completion"
msgid "popup menu item align order"
msgstr ""
+msgid "use fuzzy collection for specific completion modes"
+msgstr ""
+
msgid "options for the Insert mode completion info popup"
msgstr ""
void free_insexpand_stuff(void);
int ins_compl_cancel(void);
void f_complete_match(typval_T *argvars, typval_T *rettv);
+int ins_compl_setup_autocompl(int c);
+// void ins_compl_disable_autocompl(void);
/* vim: set ft=c : */
int plines_m_win(win_T *wp, linenr_T first, linenr_T last, int max);
int gchar_pos(pos_T *pos);
int gchar_cursor(void);
+int char_before_cursor(void);
void pchar_cursor(int c);
char_u *skip_to_option_part(char_u *p);
void check_status(buf_T *buf);
func Test_cpt_func_cursorcol()
func CptColTest(findstart, query)
if a:findstart
- call assert_equal("foo bar", getline(1))
- call assert_equal(8, col('.'))
+ call assert_equal(b:info_compl_line, getline(1))
+ call assert_equal(b:info_cursor_col, col('.'))
return col('.')
endif
- call assert_equal("foo ", getline(1))
- call assert_equal(5, col('.'))
+ call assert_equal(b:expn_compl_line, getline(1))
+ call assert_equal(b:expn_cursor_col, col('.'))
return v:none
endfunc
set complete=FCptColTest
new
- call feedkeys("ifoo bar\<C-N>", "tx")
- bwipe!
- new
+
+ " Replace mode
+ let b:info_compl_line = "foo barxyz"
+ let b:expn_compl_line = "foo barbaz"
+ let b:info_cursor_col = 10
+ let b:expn_cursor_col = 5
+ call feedkeys("ifoo barbaz\<Esc>2hRxy\<C-N>", "tx")
+
+ " Insert mode
+ let b:info_compl_line = "foo bar"
+ let b:expn_compl_line = "foo "
+ let b:info_cursor_col = 8
+ let b:expn_cursor_col = 5
+ call feedkeys("Sfoo bar\<C-N>", "tx")
+
set completeopt=longest
- call feedkeys("ifoo bar\<C-N>", "tx")
- bwipe!
- new
+ call feedkeys("Sfoo bar\<C-N>", "tx")
+
set completeopt=menuone
- call feedkeys("ifoo bar\<C-N>", "tx")
- bwipe!
- new
+ call feedkeys("Sfoo bar\<C-N>", "tx")
+
set completeopt=menuone,preinsert
- call feedkeys("ifoo bar\<C-N>", "tx")
+ call feedkeys("Sfoo bar\<C-N>", "tx")
bwipe!
set complete& completeopt&
delfunc CptColTest
exe "normal ggdGShello helio heo\<C-X>\<C-N>\<ESC>"
call assert_equal("hello helio heo", getline('.'))
- " kdcit
+ " dict
call writefile(['help'], 'test_keyword.txt', 'D')
set complete=ktest_keyword.txt
exe "normal ggdGSh\<C-N>\<ESC>"
unlet g:do_complete
endfunc
+" Test that option shortmess=c turns off completion messages
+func Test_shortmess()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, ['hello', 'hullo', 'heee'])
+ END
+
+ call writefile(lines, 'Xpumscript', 'D')
+ let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12})
+ call term_sendkeys(buf, "Goh\<C-N>")
+ call TermWait(buf, 200)
+ call VerifyScreenDump(buf, 'Test_shortmess_complmsg_1', {})
+ call term_sendkeys(buf, "\<ESC>:set shm+=c\<CR>")
+ call term_sendkeys(buf, "Sh\<C-N>")
+ call TermWait(buf, 200)
+ call VerifyScreenDump(buf, 'Test_shortmess_complmsg_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Test 'complete' containing F{func} that complete from nonkeyword
func Test_nonkeyword_trigger()
unlet g:CallCount
endfunc
-" Test that option shortmess=c turns off completion messages
-func Test_shortmess()
- CheckScreendump
+func Test_autocomplete_trigger()
+ " Trigger expansion even when another char is waiting in the typehead
+ call test_override("char_avail", 1)
- let lines =<< trim END
- call setline(1, ['hello', 'hullo', 'heee'])
- END
+ let g:CallCount = 0
+ func! NonKeywordComplete(findstart, base)
+ let line = getline('.')->strpart(0, col('.') - 1)
+ let nonkeyword2 = len(line) > 1 && match(line[-2:-2], '\k') != 0
+ if a:findstart
+ return nonkeyword2 ? col('.') - 3 : (col('.') - 2)
+ else
+ let g:CallCount += 1
+ return [$"{a:base}foo", $"{a:base}bar"]
+ endif
+ endfunc
- call writefile(lines, 'Xpumscript', 'D')
- let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12})
- call term_sendkeys(buf, "Goh\<C-N>")
- call TermWait(buf, 200)
- call VerifyScreenDump(buf, 'Test_shortmess_complmsg_1', {})
- call term_sendkeys(buf, "\<ESC>:set shm+=c\<CR>")
- call term_sendkeys(buf, "Sh\<C-N>")
- call TermWait(buf, 200)
- call VerifyScreenDump(buf, 'Test_shortmess_complmsg_2', {})
+ new
+ inoremap <buffer> <F2> <Cmd>let b:matches = complete_info(["matches"]).matches<CR>
+ inoremap <buffer> <F3> <Cmd>let b:selected = complete_info(["selected"]).selected<CR>
- call StopVimInTerminal(buf)
+ call setline(1, ['abc', 'abcd', 'fo', 'b', ''])
+ set autocomplete
+
+ " Test 1a: Nonkeyword doesn't open menu without F{func} when autocomplete
+ call feedkeys("GS=\<F2>\<Esc>0", 'tx!')
+ call assert_equal([], b:matches)
+ call assert_equal('=', getline('.'))
+ " ^N opens menu of keywords (of len > 1)
+ call feedkeys("S=\<C-E>\<C-N>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'abcd', 'fo'], b:matches->mapnew('v:val.word'))
+ call assert_equal('=abc', getline('.'))
+
+ " Test 1b: With F{func} nonkeyword collects matches
+ set complete=.,FNonKeywordComplete
+ let g:CallCount = 0
+ call feedkeys("S=\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['=foo', '=bar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+ call assert_equal('=', getline('.'))
+ let g:CallCount = 0
+ call feedkeys("S->\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['->foo', '->bar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+ call assert_equal('->', getline('.'))
+
+ " Test 1c: Keyword after nonkeyword can collect both types of items
+ let g:CallCount = 0
+ call feedkeys("S#a\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abcd', 'abc', '#afoo', '#abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+ call assert_equal('#a', getline('.'))
+ let g:CallCount = 0
+ call feedkeys("S#a.\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['.foo', '.bar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(3, g:CallCount)
+ call assert_equal('#a.', getline('.'))
+ let g:CallCount = 0
+ call feedkeys("S#a.a\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abcd', 'abc', '.afoo', '.abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(4, g:CallCount)
+ call assert_equal('#a.a', getline('.'))
+
+ " Test 1d: Nonkeyword after keyword collects items again
+ let g:CallCount = 0
+ call feedkeys("Sa\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abcd', 'abc', 'afoo', 'abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+ call assert_equal('a', getline('.'))
+ let g:CallCount = 0
+ call feedkeys("Sa#\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['#foo', '#bar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+ call assert_equal('a#', getline('.'))
+
+ " Test 2: Filter nonkeyword and keyword matches with differet startpos
+ for fuzzy in range(2)
+ if fuzzy
+ set completeopt+=fuzzy
+ endif
+ call feedkeys("S#ab\<F2>\<F3>\<Esc>0", 'tx!')
+ if fuzzy
+ call assert_equal(['#abar', 'abc', 'abcd'], b:matches->mapnew('v:val.word'))
+ else " Ordering of items is by 'nearest' to cursor by default
+ call assert_equal(['abcd', 'abc', '#abar'], b:matches->mapnew('v:val.word'))
+ endif
+ call assert_equal(-1, b:selected)
+ call assert_equal('#ab', getline('.'))
+ call feedkeys("S#ab" . repeat("\<C-N>", 3) . "\<F3>\<Esc>0", 'tx!')
+ call assert_equal(fuzzy ? '#abcd' : '#abar', getline('.'))
+ call assert_equal(2, b:selected)
+
+ let g:CallCount = 0
+ call feedkeys("GS#aba\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['#abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+ call assert_equal('#aba', getline('.'))
+
+ let g:CallCount = 0
+ call feedkeys("S#abc\<F2>\<Esc>0", 'tx!')
+ if fuzzy
+ call assert_equal(['abc', 'abcd'], b:matches->mapnew('v:val.word'))
+ else
+ call assert_equal(['abcd', 'abc'], b:matches->mapnew('v:val.word'))
+ endif
+ call assert_equal(2, g:CallCount)
+ set completeopt&
+ endfor
+
+ " Test 3: Navigate menu containing nonkeyword and keyword items
+ call feedkeys("S#a\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abcd', 'abc', '#afoo', '#abar'], b:matches->mapnew('v:val.word'))
+ call feedkeys("S#a" . repeat("\<C-N>", 3) . "\<Esc>0", 'tx!')
+ call assert_equal('#afoo', getline('.'))
+ call feedkeys("S#a" . repeat("\<C-N>", 3) . "\<C-P>\<Esc>0", 'tx!')
+ call assert_equal('#abc', getline('.'))
+
+ call feedkeys("S#a.a\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abcd', 'abc', '.afoo', '.abar'], b:matches->mapnew('v:val.word'))
+ call feedkeys("S#a.a" . repeat("\<C-N>", 2) . "\<Esc>0", 'tx!')
+ call assert_equal('#a.abc', getline('.'))
+ call feedkeys("S#a.a" . repeat("\<C-N>", 3) . "\<Esc>0", 'tx!')
+ call assert_equal('#a.afoo', getline('.'))
+ call feedkeys("S#a.a" . repeat("\<C-N>", 3) . "\<C-P>\<Esc>0", 'tx!')
+ call assert_equal('#a.abc', getline('.'))
+ call feedkeys("S#a.a" . repeat("\<C-P>", 6) . "\<Esc>0", 'tx!')
+ call assert_equal('#a.abar', getline('.'))
+
+ " Test 4a: When autocomplete menu is active, ^X^N completes buffer keywords
+ let g:CallCount = 0
+ call feedkeys("S#a\<C-X>\<C-N>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'abcd'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+
+ " Test 4b: When autocomplete menu is active, ^X^O completes omnifunc
+ let g:CallCount = 0
+ set omnifunc=NonKeywordComplete
+ call feedkeys("S#a\<C-X>\<C-O>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['#afoo', '#abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(3, g:CallCount)
+
+ " Test 4c: When autocomplete menu is active, ^E^N completes keyword
+ call feedkeys("Sa\<C-E>\<F2>\<Esc>0", 'tx!')
+ call assert_equal([], b:matches->mapnew('v:val.word'))
+ let g:CallCount = 0
+ call feedkeys("Sa\<C-E>\<C-N>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'abcd', 'afoo', 'abar'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+
+ " Test 4d: When autocomplete menu is active, ^X^L completes lines
+ %d
+ let g:CallCount = 0
+ call setline(1, ["afoo bar", "barbar foo", "foo bar", "and"])
+ call feedkeys("Goa\<C-X>\<C-L>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['afoo bar', 'and'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ " Test 5: When invalid prefix stops completion, backspace should restart it
+ %d
+ set complete&
+ call setline(1, ["afoo bar", "barbar foo", "foo bar", "and"])
+ call feedkeys("Goabc\<F2>\<Esc>0", 'tx!')
+ call assert_equal([], b:matches->mapnew('v:val.word'))
+ call feedkeys("Sabc\<BS>\<BS>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['and', 'afoo'], b:matches->mapnew('v:val.word'))
+ call feedkeys("Szx\<BS>\<F2>\<Esc>0", 'tx!')
+ call assert_equal([], b:matches->mapnew('v:val.word'))
+ call feedkeys("Sazx\<Left>\<BS>\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['and', 'afoo'], b:matches->mapnew('v:val.word'))
+
+ bw!
+ call test_override("char_avail", 0)
+ delfunc NonKeywordComplete
+ set autocomplete&
+ unlet g:CallCount
+endfunc
+
+" Test autocomplete timing
+func Test_autocomplete_timer()
+
+ let g:CallCount = 0
+ func! TestComplete(delay, check, refresh, findstart, base)
+ if a:findstart
+ return col('.') - 1
+ else
+ let g:CallCount += 1
+ if a:delay
+ sleep 310m " Exceed timeout
+ endif
+ if a:check
+ while !complete_check()
+ sleep 2m
+ endwhile
+ return v:none " This should trigger after interrupted by timeout
+ endif
+ let res = [["ab", "ac", "ad"], ["abb", "abc", "abd"], ["acb", "cc", "cd"]]
+ if a:refresh
+ return #{words: res[g:CallCount - 1], refresh: 'always'}
+ endif
+ return res[g:CallCount - 1]
+ endif
+ endfunc
+
+ " Trigger expansion even when another char is waiting in the typehead
+ call test_override("char_avail", 1)
+
+ new
+ inoremap <buffer> <F2> <Cmd>let b:matches = complete_info(["matches"]).matches<CR>
+ inoremap <buffer> <F3> <Cmd>let b:selected = complete_info(["selected"]).selected<CR>
+ set autocomplete
+
+ call setline(1, ['abc', 'bcd', 'cde'])
+
+ " Test 1: When matches are found before timeout expires, it exits
+ " 'collection' mode and transitions to 'filter' mode.
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 0\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("Goa\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab', 'ac', 'ad'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ let g:CallCount = 0
+ call feedkeys("Sab\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ " Test 2: When timeout expires before all matches are found, it returns
+ " with partial list but still transitions to 'filter' mode.
+ set complete=.,Ffunction('TestComplete'\\,\ [1\\,\ 0\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("Sab\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ " Test 3: When interrupted by ^N before timeout expires, it remains in
+ " 'collection' mode without transitioning.
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 1\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("Sa\<C-N>b\<F2>\<Esc>0", 'tx!')
+ call assert_equal(2, g:CallCount)
+
+ let g:CallCount = 0
+ call feedkeys("Sa\<C-N>b\<C-N>c\<F2>\<Esc>0", 'tx!')
+ call assert_equal(3, g:CallCount)
+
+ " Test 4: Simulate long running func that is stuck in complete_check()
+ let g:CallCount = 0
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 1\\,\ 0])
+ call feedkeys("Sa\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ let g:CallCount = 0
+ call feedkeys("Sab\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ " Test 5: refresh:always stays in 'collection' mode
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 0\\,\ 1])
+ let g:CallCount = 0
+ call feedkeys("Sa\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab', 'ac', 'ad'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+
+ let g:CallCount = 0
+ call feedkeys("Sab\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'abb', 'abd'], b:matches->mapnew('v:val.word'))
+ call assert_equal(2, g:CallCount)
+
+ " Test 6: <c-n> and <c-p> navigate menu
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 0\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("Sab\<c-n>\<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
+ call assert_equal(0, b:selected)
+ call assert_equal(1, g:CallCount)
+ call feedkeys("Sab\<c-n>\<c-n>\<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal(1, b:selected)
+ call feedkeys("Sab\<c-n>\<c-p>\<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal(-1, b:selected)
+
+ " Test 7: Following 'cot' option values have no effect
+ set completeopt=menu,menuone,noselect,noinsert,longest,preinsert
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 0\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("Sab\<c-n>\<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
+ call assert_equal(0, b:selected)
+ call assert_equal(1, g:CallCount)
+ call assert_equal('abc', getline(4))
+ set completeopt&
+
+ " Test 8: {func} completes after space, but not '.'
+ set complete=.,Ffunction('TestComplete'\\,\ [0\\,\ 0\\,\ 0])
+ let g:CallCount = 0
+ call feedkeys("S \<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal(['ab', 'ac', 'ad'], b:matches->mapnew('v:val.word'))
+ call assert_equal(1, g:CallCount)
+ set complete=.
+ call feedkeys("S \<F2>\<F3>\<Esc>0", 'tx!')
+ call assert_equal([], b:matches->mapnew('v:val.word'))
+
+ " Test 9: Matches nearest to the cursor are prioritized (by default)
+ %d
+ let g:CallCount = 0
+ set complete=.
+ call setline(1, ["fo", "foo", "foobar", "foobarbaz"])
+ call feedkeys("jof\<F2>\<Esc>0", 'tx!')
+ call assert_equal(['foo', 'foobar', 'fo', 'foobarbaz'], b:matches->mapnew('v:val.word'))
+
+ bw!
+ call test_override("char_avail", 0)
+ delfunc TestComplete
+ set autocomplete& complete&
+ unlet g:CallCount
endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1590,
/**/
1589,
/**/