Faster Grepping in Vim
Dan Croak November 27, 2013 vim We often search our projects for specific text within Vim like so: :grep sometext However, we have a need for speed. How can we grep faster? Override to use The Silver Searcher grep is a built-in command of Vim. By default, it will use our system's grep command. We can overwrite it to use The Silver Searcher 's ag command instead by putting this in our ~/.vimrc : " 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 Search for the word under the cursor This searches for the text under the cursor and shows the results in a "quickfix" window: " bind K to grep word under cursor nnoremap K...