Fast recursive code grepping
In almost all times that I use grep I use it to find peaces of code. I usually even know what kind of file I'm looking for. So I wrote this function that helps me on both zsh and bash:
function g! { grep -nr --exclude=.git --exclude=.hg --exclude=.svn --include="*.$1" "$2" ${3-"."} --colour; }
How it works?
g! py "some python method Im looking for"
or
g! py "some python method Im looking for" somedir
Why?
It's really fast to search and to type! Without any extra installation.
Improve
Improve it for your needs. Essencially the --exclude
parameters.
Written by Caio Ariede
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Grep
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#