]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1672: completion: cannot add timeouts for 'cpt' sources v9.1.1672
authorGirish Palya <girishji@gmail.com>
Sat, 23 Aug 2025 14:20:03 +0000 (16:20 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 23 Aug 2025 14:20:03 +0000 (16:20 +0200)
Problem:  completion: cannot add timeouts for 'cpt' sources
          (Evgeni Chasnovski)
Solution: Add the 'autocompletetimeout' and 'completetimeout' options
          (Girish Palya)

fixes: #17908
closes: #17967

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
14 files changed:
runtime/doc/insert.txt
runtime/doc/options.txt
runtime/doc/quickref.txt
runtime/doc/tags
runtime/doc/version9.txt
runtime/optwin.vim
runtime/syntax/vim.vim
src/insexpand.c
src/option.h
src/optiondefs.h
src/po/vim.pot
src/proto/diff.pro
src/testdir/test_ins_complete.vim
src/version.c

index d017042c89b76bd04491ad26e6bef64c9e15f70d..860fe08ebe279b3913120777e586ef83b12e14f2 100644 (file)
@@ -1,4 +1,4 @@
-*insert.txt*    For Vim version 9.1.  Last change: 2025 Aug 16
+*insert.txt*    For Vim version 9.1.  Last change: 2025 Aug 23
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1138,18 +1138,20 @@ 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' and 'autocompletedelay'.
-The menu items are collected from the sources listed in the 'complete' option.
+but triggered automatically.  See 'autocomplete'. The menu items are collected
+from the sources listed in the 'complete' option, in order.
 
-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.
+A decaying timeout keeps Vim responsive.  Sources earlier in the 'complete'
+list get more time (higher priority), but all sources receive at least a small
+time slice.
 
 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|).
 
+See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'.
+
 
 FUNCTIONS FOR FINDING COMPLETIONS                      *complete-functions*
 
index 132b3f6af7e1b65ff28bc4e9e1aa32f720b69d17..dab6fe0fe8728c245155d8729053109b79a68403 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.1.  Last change: 2025 Aug 21
+*options.txt*  For Vim version 9.1.  Last change: 2025 Aug 23
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -925,6 +925,20 @@ A jump table for the options with a short description can be found at |Q_op|.
        typing.  If you prefer it not to open too quickly, set this value
        slightly above your typing speed.  See |ins-autocompletion|.
 
+                                       *'autocompletetimeout'* *'act'*
+'autocompletetimeout' 'act'    number  (default 80)
+                               global
+       Initial timeout (in milliseconds) for the decaying time-sliced
+       completion algorithm.  Starts at this value, halves for each slower
+       source until a minimum is reached.  All sources run, but slower ones
+       are quickly de-prioritized.  The default is tuned so the popup menu
+       opens within ~200ms even with multiple slow sources on a slow system.
+       Changing this value is rarely needed.  Only 80 or higher is valid.
+       Special case: when 'complete' contains "F" or "o" (function sources),
+       a longer timeout is used, allowing up to ~1s for sources such as LSP
+       servers that may sometimes take longer (e.g., while loading modules).
+       See |ins-autocompletion|.
+
                        *'autoindent'* *'ai'* *'noautoindent'* *'noai'*
 'autoindent' 'ai'      boolean (default off)
                        local to buffer
@@ -2325,6 +2339,12 @@ A jump table for the options with a short description can be found at |Q_op|.
        For Insert mode completion the buffer-local value is used.  For
        command line completion the global value is used.
 
+                                       *'completetimeout'* *'cto'*
+'completetimeout' 'cto'        number  (default 0)
+                       global
+       Like 'autocompletetimeout', but applies to |i_CTRL-N| and |i_CTRL-P|
+       completion.  Value of 0 disables the timeout; positive values allowed.
+
                                                *'concealcursor'* *'cocu'*
 'concealcursor' 'cocu' string (default: "")
                        local to window
index 4dbef3b7673ef9e18237c04a6495b5444402e7ff..e7dd45f824131aed9d946d779340d7f8dadb061f 100644 (file)
@@ -1,4 +1,4 @@
-*quickref.txt*  For Vim version 9.1.  Last change: 2025 Aug 16
+*quickref.txt*  For Vim version 9.1.  Last change: 2025 Aug 23
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -609,6 +609,7 @@ Short explanation of each option:           *option-list*
 'autochdir'      'acd'     change directory to the file in the current window
 'autocomplete'   'ac'      enable automatic completion in insert mode
 'autocompletedelay' 'acl'   delay in msec before menu appears after typing
+'autocompletetimeout' 'act' initial decay timeout for autocompletion algorithm
 '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
@@ -661,6 +662,7 @@ Short explanation of each option:           *option-list*
 'completeopt'    'cot'     options for Insert mode completion
 'completepopup'          'cpp'     options for the Insert mode completion info popup
 'completeslash'          'csl'     like 'shellslash' for completion
+'completetimeout' 'cto'     initial decay timeout for CTRL-N and CTRL-P
 'concealcursor'          'cocu'    whether concealable text is hidden in cursor line
 'conceallevel'   'cole'    whether concealable text is shown or hidden
 'confirm'        'cf'      ask what to do about unsaved/read-only files
index 2046d6f933c9e694d47a2c01c0dbe74dc152324c..8af54eae0a87af5b476cf59349f924fe6abc92b7 100644 (file)
@@ -44,6 +44,7 @@ $quote        eval.txt        /*$quote*
 'ac'   options.txt     /*'ac'*
 'acd'  options.txt     /*'acd'*
 'acl'  options.txt     /*'acl'*
+'act'  options.txt     /*'act'*
 'ai'   options.txt     /*'ai'*
 'akm'  options.txt     /*'akm'*
 'al'   options.txt     /*'al'*
@@ -66,6 +67,7 @@ $quote        eval.txt        /*$quote*
 'autochdir'    options.txt     /*'autochdir'*
 'autocomplete' options.txt     /*'autocomplete'*
 'autocompletedelay'    options.txt     /*'autocompletedelay'*
+'autocompletetimeout'  options.txt     /*'autocompletetimeout'*
 'autoindent'   options.txt     /*'autoindent'*
 'autoprint'    vi_diff.txt     /*'autoprint'*
 'autoread'     options.txt     /*'autoread'*
@@ -175,6 +177,7 @@ $quote      eval.txt        /*$quote*
 'completeopt'  options.txt     /*'completeopt'*
 'completepopup'        options.txt     /*'completepopup'*
 'completeslash'        options.txt     /*'completeslash'*
+'completetimeout'      options.txt     /*'completetimeout'*
 'concealcursor'        options.txt     /*'concealcursor'*
 'conceallevel' options.txt     /*'conceallevel'*
 'confirm'      options.txt     /*'confirm'*
@@ -205,6 +208,7 @@ $quote      eval.txt        /*$quote*
 'cst'  options.txt     /*'cst'*
 'csto' options.txt     /*'csto'*
 'csverb'       options.txt     /*'csverb'*
+'cto'  options.txt     /*'cto'*
 'cuc'  options.txt     /*'cuc'*
 'cul'  options.txt     /*'cul'*
 'culopt'       options.txt     /*'culopt'*
index ce8832b259d687f15b06460128a377bfb471059c..1daf2f19120db808e1c7b764c91134086ab74864 100644 (file)
@@ -41833,12 +41833,14 @@ Options: ~
 
 'autocomplete'         Enable auto completion |ins-autocompletion|
 'autocompletedelay'    Delay in msec before menu appears after typing
-'chistory'             Size of the quickfix stack |quickfix-stack|.
-'clipmethod'           How to access the clipboard.
+'autocompletetimeout'  initial decay timeout for autocompletion algorithm
+'chistory'             Size of the quickfix stack |quickfix-stack|
+'clipmethod'           How to access the clipboard
 'completefuzzycollect' Enable fuzzy collection of candidates for (some)
                        |ins-completion| modes
 'completeitemalign'    Order of |complete-items| in Insert mode completion
                        popup
+'completetimeout'      initial decay timeout for CTRL-N and CTRL-P
 'diffanchors'          list of {address} to force syncing of diffs
 'eventignorewin'       autocommand events that are ignored in a window
 'findfunc'             Vim function to obtain the results for a |:find|
index dc6aae08f8eea432495d2a8d5458425eeb0a3074..578b6099718c235e0a046b905152789cde9dcf1f 100644 (file)
@@ -1,7 +1,7 @@
 " These commands create the option window.
 "
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Aug 16
+" Last Change: 2025 Aug 23
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " If there already is an option window, jump to that one.
@@ -876,6 +876,10 @@ if has("insert_expand")
   call <SID>OptionL("cpt")
   call <SID>AddOption("autocomplete", gettext("automatic completion in insert mode"))
   call <SID>BinOptionG("ac", &ac)
+  call <SID>AddOption("autocompletetimeout", gettext("initial decay timeout for 'autocomplete' algorithm"))
+  call append("$", " \tset act=" . &act)
+  call <SID>AddOption("completetimeout", gettext("initial decay timeout for CTRL-N and CTRL-P completion"))
+  call append("$", " \tset cto=" . &cto)
   call <SID>AddOption("autocompletedelay", gettext("delay in msec before menu appears after typing"))
   call append("$", " \tset acl=" . &acl)
   call <SID>AddOption("completeopt", gettext("whether to use a popup menu for Insert mode completion"))
index dd9f78b838100adeb2963d9765ebf5f80fdef4fd..4161ee9550816c7e2b1964eec135a729526ff8ee 100644 (file)
@@ -63,11 +63,11 @@ syn keyword vimStdPlugin contained  Arguments Asm Break Cfilter Clear Continue Di
 
 " 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 ac autocomplete acl autocompletedelay 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 skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained cms commentstring 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 skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained ei eventignore 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 skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained hls hlsearch 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 skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption 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 ph pumheight skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ac autocomplete acl autocompletedelay act autocompletetimeout 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 cto completetimeout 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
@@ -102,15 +102,16 @@ syn match   vimOption contained   "t_k;"
 
 " 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 ac autocomplete acl autocompletedelay 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
-syn keyword vimOptionVarName contained com comments cms commentstring 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
-syn keyword vimOptionVarName contained efm errorformat ek esckeys ei eventignore 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
-syn keyword vimOptionVarName contained hi history hk hkmap hkp hkmapp hls hlsearch 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
-syn keyword vimOptionVarName contained mco maxcombine mfd maxfuncdepth mmd maxmapdepth 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
-syn keyword vimOptionVarName contained pmbfn printmbfont popt printoptions prompt 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
-syn keyword vimOptionVarName contained sbr showbreak sc showcmd sloc showcmdloc 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
-syn keyword vimOptionVarName contained twsl termwinscroll tws termwinsize 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
-syn keyword vimOptionVarName contained wfb winfixbuf wfh winfixheight wfw winfixwidth 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
+syn keyword vimOptionVarName contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ac autocomplete acl autocompletedelay act autocompletetimeout 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 cto completetimeout 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
index dc6f02784c1e50558de210ac8ca63faeea6710d6..3ca6e23e6597c2936aa38b612e1985e62911c1b4 100644 (file)
@@ -203,6 +203,9 @@ static buf_T          *compl_curr_buf = NULL;  // buf where completion is active
 // 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.
+// Special case: when 'complete' contains "F" or "o" (function sources), a
+// longer fixed timeout is used (COMPL_FUNC_TIMEOUT_MS or
+// COMPL_FUNC_TIMEOUT_NON_KW_MS). - girish
 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
@@ -216,6 +219,10 @@ static int   compl_from_nonkeyword = FALSE;    // completion started from non-ke
            compl_timeout_ms /= 2; \
     } while (0)
 
+// Timeout values for F{func}, F and o values in 'complete'
+#define COMPL_FUNC_TIMEOUT_MS          300
+#define COMPL_FUNC_TIMEOUT_NON_KW_MS   1000
+
 // List of flags for method of completion.
 static int       compl_cont_status = 0;
 # define CONT_ADDING   1       // "normal" or "adding" expansion
@@ -5393,7 +5400,7 @@ prepare_cpt_compl_funcs(void)
 compl_source_start_timer(int source_idx UNUSED)
 {
 #ifdef ELAPSED_FUNC
-    if (compl_autocomplete && cpt_sources_array != NULL)
+    if (compl_autocomplete || p_cto > 0)
     {
        ELAPSED_INIT(cpt_sources_array[source_idx].compl_start_tv);
        compl_time_slice_expired = FALSE;
@@ -5418,8 +5425,6 @@ advance_cpt_sources_index_safe(void)
     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
@@ -5439,6 +5444,8 @@ ins_compl_get_exp(pos_T *ini)
     int                type = ctrl_x_mode;
     int                may_advance_cpt_idx = FALSE;
     pos_T      start_pos = *ini;
+    int                normal_mode_strict = FALSE;
+    long       compl_timeout_save = 0;
 
     if (!compl_started)
     {
@@ -5476,15 +5483,18 @@ ins_compl_get_exp(pos_T *ini)
     st.cur_match_pos = (compl_dir_forward())
                                    ? &st.last_match_pos : &st.first_match_pos;
 
-    if (cpt_sources_array != NULL && ctrl_x_mode_normal()
-           && !ctrl_x_mode_line_or_eval()
-           && !(compl_cont_status & CONT_LOCAL))
+    normal_mode_strict = ctrl_x_mode_normal() && !ctrl_x_mode_line_or_eval()
+       && !(compl_cont_status & CONT_LOCAL) && cpt_sources_array != NULL;
+    if (normal_mode_strict)
     {
        cpt_sources_index = 0;
-       if (compl_autocomplete)
+       if (compl_autocomplete || p_cto > 0)
        {
            compl_source_start_timer(0);
-           compl_timeout_ms = COMPL_INITIAL_TIMEOUT_MS;
+           compl_time_slice_expired = FALSE;
+           compl_timeout_ms = compl_autocomplete
+               ? MAX(COMPL_INITIAL_TIMEOUT_MS, p_act)
+               : p_cto;
        }
     }
 
@@ -5517,14 +5527,18 @@ ins_compl_get_exp(pos_T *ini)
            }
        }
 
-       if (compl_autocomplete && type == CTRL_X_FUNCTION)
+       if (normal_mode_strict && type == CTRL_X_FUNCTION
+               && (compl_autocomplete || p_cto > 0))
+       {
            // 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_save = compl_timeout_ms;
            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, &start_pos);
@@ -5567,9 +5581,10 @@ ins_compl_get_exp(pos_T *ini)
            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;
+       // Restore the timeout after collecting matches from function source
+       if (normal_mode_strict && type == CTRL_X_FUNCTION
+               && (compl_autocomplete || p_cto > 0))
+           compl_timeout_ms = compl_timeout_save;
 
        // For `^P` completion, reset `compl_curr_match` to the head to avoid
        // mixing matches from different sources.
@@ -6136,9 +6151,6 @@ ins_compl_next(
 check_elapsed_time(void)
 {
 #ifdef ELAPSED_FUNC
-    if (cpt_sources_array == NULL || cpt_sources_index < 0)
-       return;
-
     elapsed_T  *start_tv
        = &cpt_sources_array[cpt_sources_index].compl_start_tv;
     long       elapsed_ms = ELAPSED_FUNC(*start_tv);
@@ -6211,8 +6223,14 @@ ins_compl_check_keys(int frequency, int in_compl_func)
            }
        }
     }
-    else if (compl_autocomplete)
-       check_elapsed_time();
+    else
+    {
+       int normal_mode_strict = ctrl_x_mode_normal()
+           && !ctrl_x_mode_line_or_eval() && !(compl_cont_status & CONT_LOCAL)
+           && cpt_sources_array != NULL && cpt_sources_index >= 0;
+       if (normal_mode_strict && (compl_autocomplete || p_cto > 0))
+           check_elapsed_time();
+    }
 
     if (compl_pending != 0 && !got_int && !(cot_flags & COT_NOINSERT)
            && !compl_autocomplete)
index b11245e44039fa45278acf71f355c63e943ca535..a17f61507b057436d3f0ffcea6134aa10bcd2f47 100644 (file)
@@ -513,6 +513,7 @@ EXTERN long p_ch;           // 'cmdheight'
 EXTERN char_u  *p_cms;         // 'commentstring'
 #endif
 EXTERN char_u  *p_cpt;         // 'complete'
+EXTERN long    p_cto;          // 'completetimeout'
 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
 EXTERN int     p_confirm;      // 'confirm'
 #endif
@@ -524,6 +525,7 @@ 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'
+EXTERN long    p_act;          // 'autocompletetimeout'
 EXTERN long    p_acl;          // 'autocompletedelay'
 // Keep in sync with p_cot_values in optionstr.c
 #define COT_MENU       0x001
index d716d89952fd28ca1e5c901e56bde9bc5df13b27..77155a63e89da647642c7bc2786b278405ad0989 100644 (file)
@@ -395,6 +395,9 @@ static struct vimoption options[] =
     {"autocompletedelay", "acl", P_NUM|P_VI_DEF,
                            (char_u *)&p_acl, PV_NONE, NULL, NULL,
                            {(char_u *)0L, (char_u *)0L} SCTX_INIT},
+    {"autocompletetimeout", "act", P_NUM|P_VI_DEF,
+                           (char_u *)&p_act, PV_NONE, NULL, NULL,
+                           {(char_u *)80L, (char_u *)0L} SCTX_INIT},
 #endif
     {"autoindent",  "ai",   P_BOOL|P_VI_DEF,
                            (char_u *)&p_ai, PV_AI, NULL, NULL,
@@ -723,6 +726,9 @@ static struct vimoption options[] =
                            {(char_u *)0L, (char_u *)0L}
 #endif
                            SCTX_INIT},
+    {"completetimeout", "cto", P_NUM|P_VI_DEF,
+                           (char_u *)&p_cto, PV_NONE, NULL, NULL,
+                           {(char_u *)0L, (char_u *)0L} SCTX_INIT},
     {"concealcursor","cocu", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF|P_FLAGLIST,
 #ifdef FEAT_CONCEAL
                            (char_u *)VAR_WIN, PV_COCU, did_set_concealcursor, expand_set_concealcursor,
index 0982f924583d5ea8c6dce7b37f8f9d147f87c72f..bf4456772612f8871bbecef7ec03b1e4d64d9575 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Vim\n"
 "Report-Msgid-Bugs-To: vim-dev@vim.org\n"
-"POT-Creation-Date: 2025-08-18 21:30+0200\n"
+"POT-Creation-Date: 2025-08-23 16:16+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"
@@ -9952,6 +9952,12 @@ msgstr ""
 msgid "automatic completion in insert mode"
 msgstr ""
 
+msgid "initial decay timeout for 'autocomplete' algorithm"
+msgstr ""
+
+msgid "initial decay timeout for CTRL-N and CTRL-P completion"
+msgstr ""
+
 msgid "delay in msec before menu appears after typing"
 msgstr ""
 
index 3a4929b0ccfba53a1d276e3a0df660a3a9e56b79..e87e81b8c422ad4ee6e614ad610dd21c448a5be6 100644 (file)
@@ -22,8 +22,10 @@ int diffopt_horizontal(void);
 int diffopt_hiddenoff(void);
 int diffopt_closeoff(void);
 void diff_update_line(linenr_T lnum);
+#ifdef FEAT_DIFF
 int diff_change_parse(diffline_T *diffline, diffline_change_T *change, int *change_start, int *change_end);
 int diff_find_change(win_T *wp, linenr_T lnum, diffline_T *diffline);
+#endif
 int diff_infold(win_T *wp, linenr_T lnum);
 void nv_diffgetput(int put, long count);
 void ex_diffgetput(exarg_T *eap);
index b5e9691201c14d4d2a70d3753617498b162ce8a9..6205f87c036bb9b68ff7d06d86100fcd356f8bb5 100644 (file)
@@ -5460,6 +5460,68 @@ func Test_omni_start_invalid_col()
   set omnifunc& complete&
 endfunc
 
+func Test_completetimeout_autocompletetimeout()
+  func OmniFunc(findstart, base)
+    if a:findstart
+      return 1
+    else
+      return ['fooOmni']
+    endif
+  endfunc
+
+  set omnifunc=OmniFunc
+  call test_override("char_avail", 1)
+  inoremap <F2> <Cmd>let b:matches = complete_info(["matches"]).matches<CR>
+
+  call setline(1, ['foobar', 'foobarbaz'])
+  new
+  call setline(1, ['foo', 'foobaz', ''])
+  set complete=.,o,w
+  call feedkeys("G", 'xt!')
+
+  set autocomplete
+  for tt in [1, 80, 1000, -1, 0]
+    exec $'set autocompletetimeout={tt}'
+    call feedkeys("\<Esc>Sf\<F2>\<Esc>0", 'xt!')
+    call assert_equal(['foobaz', 'foo', 'fooOmni', 'foobar', 'foobarbaz'], b:matches->mapnew('v:val.word'))
+  endfor
+  set autocomplete&
+
+  for tt in [80, 1000, -1, 0]
+    exec $'set completetimeout={tt}'
+    call feedkeys("\<Esc>Sf\<C-N>\<F2>\<Esc>0", 'xt!')
+    call assert_equal(['foo', 'foobaz', 'fooOmni', 'foobar', 'foobarbaz'], b:matches->mapnew('v:val.word'))
+  endfor
+
+  " Clock does not have fine granularity, so checking 'elapsed time' is only
+  " approximate. We can only test that some type of timeout is enforced.
+  call feedkeys("\<Esc>", 'xt!')
+  call setline(1, map(range(60000), '"foo" . v:val'))
+  set completetimeout=1
+  call feedkeys("Gof\<C-N>\<F2>\<Esc>0", 'xt!')
+  let match_count = len(b:matches->mapnew('v:val.word'))
+  call assert_true(match_count < 2000)
+
+  set completetimeout=1000
+  call feedkeys("\<Esc>Sf\<C-N>\<F2>\<Esc>0", 'xt!')
+  let match_count = len(b:matches->mapnew('v:val.word'))
+  call assert_true(match_count > 2000)
+
+  set autocomplete
+  set autocompletetimeout=81
+  call feedkeys("\<Esc>Sf\<F2>\<Esc>0", 'xt!')
+  let match_count = len(b:matches->mapnew('v:val.word'))
+  call assert_true(match_count < 50000)
+
+  call feedkeys("\<Esc>", 'xt!')
+  set complete& omnifunc& autocomplete& autocompletetimeout& completetimeout&
+  bwipe!
+  %d
+  call test_override("char_avail", 0)
+  iunmap <F2>
+  delfunc OmniFunc
+endfunc
+
 func Test_autocompletedelay()
   CheckScreendump
 
index 4525356fb8f8c83110de5114647f279d5f3d4d32..718c415006a9ad80d4f7ebc6fabc097f03e4bf4a 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1672,
 /**/
     1671,
 /**/