diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index e71f0d635f..5c29048533 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2025 Jul 08 +*options.txt* For Vim version 9.1. Last change: 2025 Jul 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5898,6 +5898,15 @@ A jump table for the options with a short description can be found at |Q_op|. used. Also see 'maxmem'. + *'maxsearchcount'* *'msc'* +'maxsearchcount' 'msc' number (default 99) + global + Maximum number of matches shown for the search count status |shm-S| + When the number of matches exceeds this value, Vim shows ">" instead + of the exact count to keep searching fast. + Note: larger values may impact performance. + The value must be between 1 and 9999. + *'menuitems'* *'mis'* 'menuitems' 'mis' number (default 25) global @@ -7669,7 +7678,8 @@ A jump table for the options with a short description can be found at |Q_op|. is shown), the "search hit BOTTOM, continuing at TOP" and "search hit TOP, continuing at BOTTOM" messages are only indicated by a "W" (Mnemonic: Wrapped) letter before the - search count statistics. + search count statistics. The maximum limit can be set with + the 'maxsearchcount' option. This gives you the opportunity to avoid that a change between buffers requires you to hit , but still gives as useful a message as diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 9af0c24f4c..d2adb26570 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 9.1. Last change: 2025 Jul 06 +*pattern.txt* For Vim version 9.1. Last change: 2025 Jul 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -189,6 +189,7 @@ The following options affect how a search is performed in Vim: 'ignorecase' ignore case when searching 'imsearch' use |IME| when entering the search pattern 'incsearch' show matches incrementally as the pattern is typed + 'maxsearchcount' maximum number for the search count |shm-S| 'shortmess' suppress messages |shm-s|; show search count |shm-S| 'smartcase' override 'ignorecase' if pattern contains uppercase 'wrapscan' continue searching from the start of the file diff --git a/runtime/doc/tags b/runtime/doc/tags index a037e6646b..384b27aa62 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -506,6 +506,7 @@ $quote eval.txt /*$quote* 'maxmem' options.txt /*'maxmem'* 'maxmempattern' options.txt /*'maxmempattern'* 'maxmemtot' options.txt /*'maxmemtot'* +'maxsearchcount' options.txt /*'maxsearchcount'* 'mco' options.txt /*'mco'* 'mef' options.txt /*'mef'* 'menc' options.txt /*'menc'* @@ -545,6 +546,7 @@ $quote eval.txt /*$quote* 'mousetime' options.txt /*'mousetime'* 'mp' options.txt /*'mp'* 'mps' options.txt /*'mps'* +'msc' options.txt /*'msc'* 'msm' options.txt /*'msm'* 'mzq' options.txt /*'mzq'* 'mzquantum' options.txt /*'mzquantum'* diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 3566e452e3..a89ab4f1e5 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2025 Jul 08 +*version9.txt* For Vim version 9.1. Last change: 2025 Jul 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41598,41 +41598,41 @@ Completion~ Platform specific~ ----------------- -Support for Wayland UI and support for the Wayland clipboard has been added. +- Support for Wayland UI and support for the Wayland clipboard has been added. -Support for the XDG Desktop Specification |xdg-base-dir| has been added and -the environment variable |$MYVIMDIR| is set to the users personal runtime -directory ($HOME/.vim or $HOME/.config/vim on Linux, $HOME/vimfiles on -Windows). +- Support for the XDG Desktop Specification |xdg-base-dir| has been added and + the environment variable |$MYVIMDIR| is set to the users personal runtime + directory ($HOME/.vim or $HOME/.config/vim on Linux, $HOME/vimfiles on + Windows). -Python3 support in OpenVMS is now available. +- Python3 support in OpenVMS is now available. -The Win32 GUI comes with better toolbar icons. +- The Win32 GUI comes with better toolbar icons. *new-other-9.2* Other new features ~ ------------------ -Support for Super key mappings in GTK using . +- Support for Super key mappings in GTK using . -The new packages |package-comment|, |package-nohlsearch|, |package-hlyank| and -|help-TOC| are included. +- The new packages |package-comment|, |package-nohlsearch|, |package-hlyank| and + |help-TOC| are included. -An interactive tutor plugin has been included |vim-tutor-mode| and can be -started via |:Tutor|. +- An interactive tutor plugin has been included |vim-tutor-mode| and can be + started via |:Tutor|. -Support for translating messages in Vim script plugins using the |gettext()| -and |bindtextdomain()| functions was included. +- Support for translating messages in Vim script plugins using the |gettext()| + and |bindtextdomain()| functions was included. -Support highlighting the matched text and the completion kind for insert-mode -completion and command-line completion in |ins-completion-menu|, see -|complete-items|. +- Support highlighting the matched text and the completion kind for + insert-mode completion and command-line completion in |ins-completion-menu|, + see |complete-items|. -A new vertical |tabpanel| window has been included which is a vertical -'tabline'. +- A new vertical |tabpanel| window has been included which is a vertical + 'tabline'. -The |dist#vim9#Launch()| and |dist#vim9#Open()| functions have been added to -the |vim-script-library| and decoupled from |netrw|. +- The |dist#vim9#Launch()| and |dist#vim9#Open()| functions have been added to + the |vim-script-library| and decoupled from |netrw|. -The new digraph "APPROACHES THE LIMIT" using ".=" has been added +- The new digraph "APPROACHES THE LIMIT" using ".=" has been added. *changed-9.2* Changed~ @@ -41798,7 +41798,8 @@ Options: ~ 'findfunc' Vim function to obtain the results for a |:find| command 'isexpand' defines triggers for completion -'lhistory' Size of the location list stack |quickfix-stack|. +'lhistory' Size of the location list stack |quickfix-stack| +'maxsearchcount' Set the maximum number for search-stat |shm-S| 'messagesopt' configure |:messages| and |hit-enter| prompt 'pummaxwidth' maximum width for the completion popup menu 'showtabpanel' When to show the |tabpanel| @@ -41810,6 +41811,10 @@ Options: ~ 't_CF' Support for alternate font highlighting terminal code 'winfixbuf' Keep buffer focused in a window +Vim Arguments: ~ +|-Y| Do not connect to the Wayland compositor. + + ============================================================================== INCOMPATIBLE CHANGES *incompatible-9.2* diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 0158f9775d..272f4ae502 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: The Vim Project -" Last Change: 2025 Jul 05 +" Last Change: 2025 Jul 10 " Former Maintainer: Bram Moolenaar " If there already is an option window, jump to that one. @@ -283,6 +283,8 @@ call AddOption("ignorecase", gettext("ignore case when using a search patte call BinOptionG("ic", &ic) call AddOption("smartcase", gettext("override 'ignorecase' when pattern has upper case characters")) call BinOptionG("scs", &scs) +call AddOption("maxsearchcount", gettext("Maximum number for the search count feature")) +call OptionG("msc", &msc) call AddOption("casemap", gettext("what method to use for changing case of letters")) call OptionG("cmp", &cmp) call AddOption("maxmempattern", gettext("maximum amount of memory in Kbyte used for pattern matching")) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 274954e0d9..ee107b1b5a 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi " Doug Kearns -" Last Change: 2025 Jul 05 +" Last Change: 2025 Jul 10 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -55,11 +55,11 @@ syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab ara 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 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 et expandtab skipwhite nextgroup=vimSetEqual,vimSetMod syn keyword vimOption contained 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 ic ignorecase skipwhite nextgroup=vimSetEqual,vimSetMod syn keyword vimOption contained 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 mmt maxmemtot skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 pw pumwidth pythondll pythonhome skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 smd showmode stal showtabline stpl showtabpanel skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 pw pumwidth pythondll skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 smd showmode stal showtabline skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 tx textmode tw textwidth tsr thesaurus skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 wmw winminwidth winptydll wiw winwidth skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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='' @@ -94,11 +94,11 @@ syn keyword vimOptionVarName contained al aleph ari allowrevins ambw ambiwidth a 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 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 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 pw pumwidth -syn keyword vimOptionVarName contained 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 smd showmode -syn keyword vimOptionVarName contained 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 tx textmode -syn keyword vimOptionVarName contained 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 wmw winminwidth -syn keyword vimOptionVarName contained 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 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 " 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 diff --git a/src/option.c b/src/option.c index af07664df8..e1cf29ecf3 100644 --- a/src/option.c +++ b/src/option.c @@ -4138,6 +4138,29 @@ did_set_scrollbind(optset_T *args UNUSED) return NULL; } +/* + * Process the new 'maxsearchcount' option value. + */ + char * +did_set_maxsearchcount(optset_T *args UNUSED) +{ + char *errmsg = NULL; +// if you increase this, also increase SEARCH_STAT_BUF_LEN in search.c +#define MAX_SEARCH_COUNT 9999 + + if (p_msc <= 0) + errmsg = e_argument_must_be_positive; + else if (p_msc > MAX_SEARCH_COUNT) + errmsg = e_invalid_argument; + + if (errmsg != NULL) + p_msc = 99; + + return errmsg; +#undef MAX_SEARCH_COUNT +} + + #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO) /* * Process the updated 'shellslash' option value. diff --git a/src/option.h b/src/option.h index 91810c5611..c57539731d 100644 --- a/src/option.h +++ b/src/option.h @@ -792,6 +792,7 @@ EXTERN long p_mmt; // 'maxmemtot' EXTERN long p_mis; // 'menuitems' #endif EXTERN char_u *p_mopt; // 'messagesopt' +EXTERN long p_msc; // 'maxsearchcount' #ifdef FEAT_SPELL EXTERN char_u *p_msm; // 'mkspellmem' #endif diff --git a/src/optiondefs.h b/src/optiondefs.h index 3074181831..a2d4495411 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -1733,6 +1733,9 @@ static struct vimoption options[] = (char_u *)&p_mmt, PV_NONE, NULL, NULL, {(char_u *)DFLT_MAXMEMTOT, (char_u *)0L} SCTX_INIT}, + {"maxsearchcount", "msc", P_NUM|P_VI_DEF, + (char_u *)&p_msc, PV_NONE, did_set_maxsearchcount, NULL, + {(char_u *)99L, (char_u *)0L} SCTX_INIT}, {"menuitems", "mis", P_NUM|P_VI_DEF, #ifdef FEAT_MENU (char_u *)&p_mis, PV_NONE, NULL, NULL, diff --git a/src/proto/option.pro b/src/proto/option.pro index b93a252f47..7429002be1 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -65,6 +65,7 @@ char *did_set_pyxversion(optset_T *args); char *did_set_readonly(optset_T *args); char *did_set_scrollbind(optset_T *args); char *did_set_shellslash(optset_T *args); +char *did_set_maxsearchcount(optset_T *args); char *did_set_shiftwidth_tabstop(optset_T *args); char *did_set_showtabline(optset_T *args); char *did_set_smoothscroll(optset_T *args); diff --git a/src/search.c b/src/search.c index 425d0d3b5e..cdd171e954 100644 --- a/src/search.c +++ b/src/search.c @@ -55,8 +55,9 @@ static int fuzzy_match_func_compare(const void *s1, const void *s2); static void fuzzy_match_func_sort(fuzmatch_str_T *fm, int sz); #define SEARCH_STAT_DEF_TIMEOUT 40L -#define SEARCH_STAT_DEF_MAX_COUNT 99 -#define SEARCH_STAT_BUF_LEN 12 +// 'W ': 2 + +// '[>9999/>9999]': 13 + 1 (NUL) +#define SEARCH_STAT_BUF_LEN 16 /* * This file contains various searching-related routines. These fall into @@ -1696,7 +1697,7 @@ do_search( NULL, NULL)) #endif ), - SEARCH_STAT_DEF_MAX_COUNT, + p_msc, SEARCH_STAT_DEF_TIMEOUT); /* @@ -3265,7 +3266,7 @@ update_search_stat( static int cnt = 0; static int exact_match = FALSE; static int incomplete = 0; - static int last_maxcount = SEARCH_STAT_DEF_MAX_COUNT; + static int last_maxcount = 0; static int chgtick = 0; static char_u *lastpat = NULL; static size_t lastpatlen = 0; @@ -3282,7 +3283,7 @@ update_search_stat( stat->cnt = cnt; stat->exact_match = exact_match; stat->incomplete = incomplete; - stat->last_maxcount = last_maxcount; + stat->last_maxcount = p_msc; return; } last_maxcount = maxcount; @@ -4174,7 +4175,7 @@ f_searchcount(typval_T *argvars, typval_T *rettv) { pos_T pos = curwin->w_cursor; char_u *pattern = NULL; - int maxcount = SEARCH_STAT_DEF_MAX_COUNT; + int maxcount = p_msc; long timeout = SEARCH_STAT_DEF_TIMEOUT; int recompute = TRUE; searchstat_T stat; diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index 5a0f16303f..5b7050be73 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -477,4 +477,166 @@ func Test_search_stat_smartcase_ignorecase() call StopVimInTerminal(buf) endfunc +func Test_search_stat_option_values() + call assert_fails(':set maxsearchcount=0', 'E487:') + call assert_fails(':set maxsearchcount=10000', 'E474:') + set maxsearchcount=9999 + call assert_equal(9999, &msc) + set maxsearchcount=1 + call assert_equal(1, &msc) + set maxsearchcount=999 + call assert_equal(999, &msc) + set maxsearchcount&vim +endfunc + +func Test_search_stat_option() + " Asan causes wrong results, because the search times out + CheckNotAsan + enew + set shortmess-=S + set maxsearchcount=999 + " Append 1000 lines with text to search for, "foobar" appears 20 times + call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 1000)) + + call cursor(1, 1) + call assert_equal( + \ #{exact_match: 1, current: 1, incomplete: 2, maxcount: 999, total: 1000}, + \ searchcount(#{pattern: 'fooooobar', pos: [3, 1, 0]})) + " on last char of match + call assert_equal( + \ #{exact_match: 1, current: 1, incomplete: 2, maxcount: 999, total: 1000}, + \ searchcount(#{pattern: 'fooooobar', pos: [3, 9, 0]})) + " on char after match + call assert_equal( + \ #{exact_match: 0, current: 1, incomplete: 2, maxcount: 999, total: 1000}, + \ searchcount(#{pattern: 'fooooobar', pos: [3, 10, 0]})) + + " match at second line + let messages_before = execute('messages') + let @/ = 'fo*\(bar\?\)\?' + let g:a = execute(':unsilent :norm! n') + let stat = '\[2/>999\]' + let pat = escape(@/, '()*?'). '\s\+' + call assert_match(pat .. stat, g:a) + call assert_equal( + \ #{exact_match: 1, current: 2, incomplete: 2, maxcount: 999, total: 1000}, + \ searchcount(#{recompute: 0})) + " didn't get added to message history + call assert_equal(messages_before, execute('messages')) + + " Many matches + call cursor(line('$')-2, 1) + let @/ = '.' + let pat = escape(@/, '()*?'). '\s\+' + let g:a = execute(':unsilent :norm! n') + let stat = '\[>999/>999\]' + call assert_match(pat .. stat, g:a) + call assert_equal( + \ #{exact_match: 0, current: 1000, incomplete: 2, maxcount: 999, total: 1000}, + \ searchcount(#{recompute: 0})) + call assert_equal( + \ #{exact_match: 1, current: 27992, incomplete: 0, maxcount:0, total: 28000}, + \ searchcount(#{recompute: v:true, maxcount: 0, timeout: 200})) + call assert_equal( + \ #{exact_match: 1, current: 1, incomplete: 0, maxcount: 0, total: 28000}, + \ searchcount(#{recompute: 1, maxcount: 0, pos: [1, 1, 0], timeout: 200})) + call cursor(line('$'), 1) + let g:a = execute(':unsilent :norm! n') + let stat = 'W \[1/>999\]' + call assert_match(pat .. stat, g:a) + call assert_equal( + \ #{current: 1, exact_match: 1, total: 1000, incomplete: 2, maxcount: 999}, + \ searchcount(#{recompute: 0})) + call assert_equal( + \ #{current: 1, exact_match: 1, total: 28000, incomplete: 0, maxcount: 0}, + \ searchcount(#{recompute: 1, maxcount: 0, timeout: 200})) + call assert_equal( + \ #{current: 27991, exact_match: 1, total: 28000, incomplete: 0, maxcount: 0}, + \ searchcount(#{recompute: 1, maxcount: 0, pos: [line('$')-2, 1, 0], timeout: 200})) + + " Many matches + call cursor(1, 1) + let g:a = execute(':unsilent :norm! n') + let stat = '\[2/>999\]' + call assert_match(pat .. stat, g:a) + call cursor(1, 1) + let g:a = execute(':unsilent :norm! N') + let stat = '\[>999/>999\]' + call assert_match(pat .. stat, g:a) + set maxsearchcount=500 + call cursor(1, 1) + let g:a = execute(':unsilent :norm! n') + let stat = '\[2/>500\]' + call assert_match(pat .. stat, g:a) + call cursor(1, 1) + let g:a = execute(':unsilent :norm! N') + let stat = '\[>500/>500\]' + call assert_match(pat .. stat, g:a) + set maxsearchcount=20 + call cursor(1, 1) + let g:a = execute(':unsilent :norm! n') + let stat = '\[2/>20\]' + call assert_match(pat .. stat, g:a) + call cursor(1, 1) + let g:a = execute(':unsilent :norm! N') + let stat = '\[>20/>20\]' + call assert_match(pat .. stat, g:a) + set maxsearchcount=999 + + " right-left + if exists("+rightleft") + set rl + call cursor(1,1) + let @/ = 'foobar' + let pat = 'raboof/\s\+' + let g:a = execute(':unsilent :norm! n') + let stat = '\[>999/2\]' + call assert_match(pat .. stat, g:a) + + " right-left bottom + call cursor('$',1) + let pat = 'raboof?\s\+' + let g:a = execute(':unsilent :norm! N') + let stat = '\[>999/>999\]' + call assert_match(pat .. stat, g:a) + + " right-left back at top + call cursor('$',1) + let pat = 'raboof/\s\+' + let g:a = execute(':unsilent :norm! n') + let stat = 'W \[>999/1\]' + call assert_match(pat .. stat, g:a) + set norl + endif + + " normal, back at bottom + call cursor(1,1) + let @/ = 'foobar' + let pat = '?foobar\s\+' + let g:a = execute(':unsilent :norm! N') + let stat = 'W \[>999/>999\]' + call assert_match(pat .. stat, g:a) + call assert_match('W \[>999/>999\]', Screenline(&lines)) + + " normal, no match + call cursor(1,1) + let @/ = 'zzzzzz' + let g:a = '' + try + let g:a = execute(':unsilent :norm! n') + catch /^Vim\%((\a\+)\)\=:E486/ + let stat = '' + " error message is not redir'ed to g:a, it is empty + call assert_true(empty(g:a)) + catch + call assert_false(1) + endtry + + " Clean up + set shortmess+=S + set maxsearchcount&vim + " close the window + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/util/gen_opt_test.vim b/src/testdir/util/gen_opt_test.vim index 1e0f39cf40..e796848fc6 100644 --- a/src/testdir/util/gen_opt_test.vim +++ b/src/testdir/util/gen_opt_test.vim @@ -279,6 +279,7 @@ let test_values = { \ 'renderoptions': [[''], ['xxx']], \ 'rightleftcmd': [['search'], ['xxx']], \ 'rulerformat': [['', 'xxx'], ['%-', '%(', '%15(%%']], + \ 'maxsearchcount': [[1, 10, 100, 1000], [0, -1, 10000]], \ 'selection': [['old', 'inclusive', 'exclusive'], ['', 'xxx']], \ 'selectmode': [['', 'mouse', 'key', 'cmd', 'key,cmd'], ['xxx']], \ 'sessionoptions': [['', 'blank', 'curdir', 'sesdir', diff --git a/src/version.c b/src/version.c index 7ccdbeb1f4..42d9fa5984 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1535, /**/ 1534, /**/