|
3 | 3 | helpname: 'cmdline' |
4 | 4 | --- |
5 | 5 | <div id='vimCodeElement'> |
6 | | -<a class="Constant" href="cmdline.html" name="cmdline.txt">cmdline.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2025 Sep 15<br> |
| 6 | +<a class="Constant" href="cmdline.html" name="cmdline.txt">cmdline.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2025 Sep 24<br> |
7 | 7 | <br> |
8 | 8 | <br> |
9 | 9 | <span class="Identifier">VIMリファレンスマニュアル by Bram Moolenaar</span><br> |
|
1100 | 1100 | :S シェルコマンドで利用できるように特別な文字をエスケープする。<br> |
1101 | 1101 | (<a class="Identifier" href="builtin.html#shellescape()">shellescape()</a>を参照)。最後でなければならない。例:<br> |
1102 | 1102 | <div class="helpExample"> :!dir <cfile>:S<br> |
1103 | | - :call system('chmod +w -- ' . expand('%:S'))</div> |
| 1103 | + :call system('chmod +w -- ' .. expand('%:S'))</div> |
1104 | 1104 | <br> |
1105 | 1105 | ファイル名が "src/version.c"、カレントディレクトリが "/home/mool/vim" のときの<br> |
1106 | 1106 | 例:<br> |
|
1363 | 1363 | <br> |
1364 | 1364 | <div class="helpExample"> set findfunc=Find<br> |
1365 | 1365 | func Find(arg, _)<br> |
1366 | | - if get(s:, 'filescache', []) == []<br> |
1367 | | - let s:filescache = systemlist(<br> |
1368 | | - \ 'find . -path "*/.git" -prune -o -type f -print')<br> |
| 1366 | + if empty(s:filescache)<br> |
| 1367 | + let s:filescache = globpath('.', '**', 1, 1)<br> |
| 1368 | + call filter(s:filescache, '!isdirectory(v:val)')<br> |
| 1369 | + call map(s:filescache, "fnamemodify(v:val, ':.')")<br> |
1369 | 1370 | endif<br> |
1370 | 1371 | return a:arg == '' ? s:filescache : matchfuzzy(s:filescache, a:arg)<br> |
1371 | 1372 | endfunc<br> |
| 1373 | + let s:filescache = []<br> |
1372 | 1374 | autocmd CmdlineEnter : let s:filescache = []</div> |
1373 | 1375 | <br> |
1374 | 1376 | <span class="Comment">:Grep</span> コマンドは、パターンにマッチする行を検索し、入力すると結果を動的に更新<br> |
|
1379 | 1381 | \ Grep call <SID>VisitFile()</div> |
1380 | 1382 | <br> |
1381 | 1383 | <div class="helpExample"> func s:Grep(arglead, cmdline, cursorpos)<br> |
1382 | | - let cmd = $'grep -REIHns "{a:arglead}" --exclude-dir=.git<br> |
1383 | | - \ --exclude=".*"'<br> |
| 1384 | + if match(&grepprg, '\$\*') == -1 | let &grepprg ..= ' $*' | endif<br> |
| 1385 | + let cmd = substitute(&grepprg, '\$\*', shellescape(escape(a:arglead, '\')), '')<br> |
1384 | 1386 | return len(a:arglead) > 1 ? systemlist(cmd) : []<br> |
1385 | 1387 | endfunc</div> |
1386 | 1388 | <br> |
|
0 commit comments