grep.vim (578B)
1 function! s:Grep(...) 2 return system(join(extend([&grepprg], a:000), ' ')) 3 endfunction 4 5 command! -nargs=+ -complete=file_in_path -bar Grep cgetexpr <SID>Grep(<q-args>) 6 command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr <SID>Grep(<q-args>) 7 8 cnoreabbrev <expr> grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep' 9 cnoreabbrev <expr> lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep' 10 11 augroup grep_aus 12 autocmd! 13 autocmd QuickFixCmdPost cgetexpr cwindow 14 autocmd QuickFixCmdPost lgetexpr lwindow 15 augroup END