aboutsummaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/vimrc12
1 files changed, 9 insertions, 3 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 347c264..7e2f804 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -539,10 +539,16 @@ set background=dark
" colorscheme gruber-darker
colorscheme blue
-
-function! Grep(args)
- return system('ag ' . a:args)
+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>)
+augroup quickfix
+ autocmd!
+ autocmd QuickFixCmdPost cgetexpr cwindow
+ autocmd QuickFixCmdPost lgetexpr lwindow
+augroup END
" manual highlights
" highlight Visual ctermfg=black ctermbg=LightMagenta