diff options
Diffstat (limited to '_vim/vimrc')
-rw-r--r-- | _vim/vimrc | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -300,6 +300,24 @@ inoremap <F1> <Esc> vnoremap <leader>y "+y noremap <leader>p "+p +" Instant grep + quickfix +" https://gist.github.com/romainl/56f0c28ef953ffc157f36cc495947ab3 +function! Grep(...) + return system(join([&grepprg] + [expandcmd(join(a:000, ' '))], ' ')) +endfunction +" +command! -nargs=+ -complete=file_in_path -bar Grep cgetexpr Grep(<f-args>) +command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr Grep(<f-args>) +" +cnoreabbrev <expr> grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep' +cnoreabbrev <expr> lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep' +" +augroup quickfix + autocmd! + autocmd QuickFixCmdPost cgetexpr cwindow + autocmd QuickFixCmdPost lgetexpr lwindow +augroup END + " The Silver Searcher if executable('ag') set grepprg=ag\ --vimgrep |