runtime(doc): Improve fuzzy file picker doc
Commit:
https://github.com/vim/vim/commit/7b11d840c00d3807a7ac88e131fefd886fe2cfa4
Author: Mao-Yining <
mao.y...@outlook.com>
Date: Sat Jul 18 12:48:23 2026 +0000
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 <
mao.y...@outlook.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 6427507d7..0f1fa50db 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