commit b7cd0544e91f6930536fb152e03372542b30d96f parent 1034976152d51d399a9e39e9edc8d9212bf0f8f3 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Mon, 6 Apr 2020 20:18:17 +0200 vim: make grep more useful Former-commit-id: 6f855c432367909e69737c0d6f8868e81f28e85c Diffstat:
A | vim/plugin/grep.vim | | | 15 | +++++++++++++++ |
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/vim/plugin/grep.vim b/vim/plugin/grep.vim @@ -0,0 +1,15 @@ +function! s:Grep(...) + return system(join(extend([&grepprg], a:000), ' ')) +endfunction + +command! -nargs=+ -complete=file_in_path -bar Grep cgetexpr <SID>Grep(<q-args>) +command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr <SID>Grep(<q-args>) + +cnoreabbrev <expr> grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep' +cnoreabbrev <expr> lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep' + +augroup grep_aus + autocmd! + autocmd QuickFixCmdPost cgetexpr cwindow + autocmd QuickFixCmdPost lgetexpr lwindow +augroup END