the silver searcher rocks my socks

Back when I was messing around with emacs, one of my favorite features was rgrep.  The rgrep function allowed you to recursively grep an arbitrary directory for a pattern.  The matches (eg. the grep output) appeared in a new buffer, and when you browsed through the matches, the files would automatically open in a split with point on the match itself.  Really handy.

Vim has a similar built-in feature called vimgrep, which is native to vim.  However, it’s typically a bit slow, probably because it’s native vimscript and I don’t know if it any intelligence in terms of skipping unlikely files (eg. large binaries, various git dotfiles).

Enter the silver searcher, plus the ag plugin to run the tool from within vim.  Now you can search large directories/repos almost instantly, then interactively browse through the matches in the quickfix buffer.  Really cool stuff!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s