I couldn't live without this tool today, very useful to quickly find where that method is used for example.
Nested Search:
ag functionName | ag moreSpecificContextLikeArgs
Find variable changed yesterday: git log -p --since yesterday | ag varName
Find controllers changed yesterday: git log --oneline --showfile | ag controllers
What files did I work on last week: git log --name-only --oneline --author me --since 1.weeks
How many JS commits did I do last month? git log --since 1.months --author me --name-only | ag -i '\.js$' | wc -l
How many JS commits did I do on each file last month? git log --since 1.months --author me --name-only | ag -i '\.js$' | awk '{arr[$1]++} END {for(i in arr) print arr[i]," - ",i}' | sort -r -n
Change a "classname" from MyClass to BetterName: ag MyClass # verify it only finds what you think it will
ag MyClass | awk -F':' '{print $1}' | sort | uniq | while read line
do
sed -i' ' 's/MyClass/BetterName/g' $line
done ack -C5 firstThing | less
/secondThing
One bonus ack trick that I like also like is bulk loading into Emacs for further manipulation (e.g., multi-occur and then occur-edit-mode): emacsclient -n `ack -l functionName`From what I can observe, I am generally faster than my co-workers. But it could be possible that with a great IDE, I could be faster yet. I don't feel any tug to leave, but could just mean I'm ignorant of that truly better way.