1- *cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 15
1+ *cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 24
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1161,7 +1161,7 @@ These modifiers can be given, in this order:
11611161 :S Escape special characters for use with a shell command (see
11621162 | shellescape() | ). Must be the last one. Examples: >
11631163 :!dir <cfile>:S
1164- :call system('chmod +w -- ' . expand('%:S'))
1164+ :call system('chmod +w -- ' .. expand('%:S'))
11651165
11661166 Examples, when the file name is "src/version.c", current dir
11671167"/home/mool/vim": >
@@ -1425,12 +1425,14 @@ file picker: >
14251425
14261426 set findfunc=Find
14271427 func Find(arg, _)
1428- if get(s:, 'filescache', []) == []
1429- let s:filescache = systemlist(
1430- \ 'find . -path "*/.git" -prune -o -type f -print')
1428+ if empty(s:filescache)
1429+ let s:filescache = globpath('.', '**', 1, 1)
1430+ call filter(s:filescache, '!isdirectory(v:val)')
1431+ call map(s:filescache, "fnamemodify(v:val, ':.')")
14311432 endif
14321433 return a:arg == '' ? s:filescache : matchfuzzy(s:filescache, a:arg)
14331434 endfunc
1435+ let s:filescache = []
14341436 autocmd CmdlineEnter : let s:filescache = []
14351437
14361438 The `:Grep` command searches for lines matching a pattern and updates the
@@ -1441,8 +1443,8 @@ the `CmdlineLeavePre` autocmd from the next section): >
14411443 \ Grep call <SID>VisitFile()
14421444
14431445 func s:Grep(arglead, cmdline, cursorpos)
1444- let cmd = $'grep -REIHns "{a:arglead}" --exclude-dir=.git
1445- \ --exclude=".*"'
1446+ if match(&grepprg, '\$\*') == -1 | let &grepprg ..= ' $*' | endif
1447+ let cmd = substitute(&grepprg, '\$\*', shellescape(escape(a:arglead, '\')), '')
14461448 return len(a:arglead) > 1 ? systemlist(cmd) : []
14471449 endfunc
14481450
0 commit comments