diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 3eb59597..e2cb614f 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -126,3 +126,24 @@ nnoremap z :Goyo " => Syntastic (syntax checker) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:syntastic_python_checkers=['pyflakes'] + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => vim-ag aka The Silver Searcher +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if executable('ag') + " Use ag over grep + set grepprg=ag\ --nogroup\ --nocolor + + " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore + let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' + + " ag is fast enough that CtrlP doesn't need to cache + let g:ctrlp_use_caching = 0 +endif + +" bind K to grep word under cursor +nnoremap K :grep! "\b\b":cw + +" bind \ (backward slash) to grep shortcut +command -nargs=+ -complete=file -bar Ag silent! grep! |cwindow|redraw! +nnoremap \ :Ag