From: Mao-Yining Date: Sat, 18 Jul 2026 12:48:23 +0000 (+0000) Subject: runtime(doc): Improve fuzzy file picker doc X-Git-Tag: v9.2.0791~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b11d840c00d3807a7ac88e131fefd886fe2cfa4;p=thirdparty%2Fvim.git runtime(doc): Improve fuzzy file picker doc 1. Only reset cache after used. 2. Use `expand('**', 1, 1)` than `globpath('.', '**', 1, 1)`. | Environment | expand (s) | globpath (s) | expand faster | | --------------- | ---------- | ------------ | ------------- | | WSL (small) | 0.0491 | 0.0537 | 9.4% | | Windows (large) | 1.6606 | 2.3565 | 41.9% | 3. fnamemodify() is useless here. closes: #20767 Signed-off-by: Mao-Yining Signed-off-by: Christian Brabandt --- diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 6427507d7e..0f1fa50dbd 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 9.2. Last change: 2026 May 20 +*cmdline.txt* For Vim version 9.2. Last change: 2026 Jul 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1428,16 +1428,15 @@ For example, you can turn the native |:find| command into a fuzzy, interactive file picker: > set findfunc=Find + let s:filescache = [] func Find(arg, _) if empty(s:filescache) - let s:filescache = globpath('.', '**', 1, 1) + autocmd CmdlineLeave : ++once let s:filescache = [] + let s:filescache = expand('**', 1, 1) call filter(s:filescache, '!isdirectory(v:val)') - call map(s:filescache, "fnamemodify(v:val, ':.')") endif - return a:arg == '' ? s:filescache : matchfuzzy(s:filescache, a:arg) + return empty(a:arg) ? s:filescache : matchfuzzy(s:filescache, a:arg) endfunc - let s:filescache = [] - autocmd CmdlineEnter : let s:filescache = [] The `:Grep` command searches for lines matching a pattern and updates the results dynamically as you type (triggered after two characters; note: needs