Created
November 8, 2017 16:16
-
-
Save ckarnell/1717a9f85942d685b3b82393b94843f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Add this to your .vimrc and you will be able to use ':Ag <pattern>' to silver search from wherever you opened vim. | |
" You can also use 'ack' or whatever you want to use as a search tool as long as you have it installed. | |
if executable('ag') | |
set grepprg=ag\ --nogroup\ --nocolor | |
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw! | |
endif | |
" When you use ':Ag <pattern>' you can quickly look through / search each file containing the pattern and pick one to edit. | |
" YOU CAN ALSO DO ':cfdo <command>' TO RUN A COMMMAND ON EACH FILE IN THE SEARCH RESULT!!! | |
" For example, ":Ag 'oh hey'" will find every file with 'oh hey' in it, and then ':cfdo %s/oh hey/hi there/g' | |
" will replace every instance of 'oh hey' with 'hi there' in each file in the search result! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment