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
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1161,7 +1161,7 @@ These modifiers can be given, in this order:
1161
1161
:S Escape special characters for use with a shell command (see
1162
1162
| shellescape() | ). Must be the last one. Examples: >
1163
1163
:!dir <cfile>:S
1164
- :call system('chmod +w -- ' . expand('%:S'))
1164
+ :call system('chmod +w -- ' .. expand('%:S'))
1165
1165
1166
1166
Examples, when the file name is "src/version.c", current dir
1167
1167
"/home/mool/vim": >
@@ -1425,12 +1425,14 @@ file picker: >
1425
1425
1426
1426
set findfunc=Find
1427
1427
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, ':.')")
1431
1432
endif
1432
1433
return a:arg == '' ? s:filescache : matchfuzzy(s:filescache, a:arg)
1433
1434
endfunc
1435
+ let s:filescache = []
1434
1436
autocmd CmdlineEnter : let s:filescache = []
1435
1437
1436
1438
The `:Grep` command searches for lines matching a pattern and updates the
@@ -1441,8 +1443,8 @@ the `CmdlineLeavePre` autocmd from the next section): >
1441
1443
\ Grep call <SID>VisitFile()
1442
1444
1443
1445
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, '\')), '')
1446
1448
return len(a:arglead) > 1 ? systemlist(cmd) : []
1447
1449
endfunc
1448
1450
0 commit comments