6 ms·
I couldn't live without this tool today, very useful to quickly find where that method is used for example.
by cake 12y ago
I couldn't live without this tool today, very useful to quickly find where that method is used for example.
- Kiro 12y agoIs it better than just searching the project in your IDE?
- vidarh 12y agoDon't know about "cake", but my "IDE" is a command line.
- base698 12y agoI seem to find things faster than my coworkers. The ability to quickly filter out non relevant files and do nested searches of the searches is the strong point. Unix as an IDE and all.
- sillysaurus3 12y agoExamples, please? If you have the time.
- base698 12y agoThese are just a few examples I do pretty frequently: 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
- a_e_k 12y agoNested searches are handy. They can also be used to find cases of one thing within a few lines of proximity to another: 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`
- joel_perl_prog 12y agoI've often wondered about that. For me, the development environment is extremely minimalistic, by some types of standards. Linux itself, including tools like ack + vim. I use various vim tricks, not up to the point of it being my de-facto OS (as is possible to do!). 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.
- deleted 12y ago[deleted]
- coffeeaddicted 12y agoIt's better if you don't have the IDE for that project open already. Or if you search for a project which doesn't come with project files for your IDE of choice. Or if you want to pipe the results. I work a lot with IDE's but still use ack-grep regularly.
- efuquen 12y agoIt's a liberating feeling to not be a slave to your IDE. It will allow you to explore more things outside some IDE walled garden, live a little ;-)
- rbonvall 12y agoIn my case, my IDE is the command line. ack is one of its plugins. The builtin plugins are also ok (find, ls, mv, etc.). I can create my own plugins for my IDE, and there are even package managers to install new plugins (yum, apt-get).