Code for Concinnity

Local/project-based .ackrc

If you use Ack, you may be annoyed by the fact that it only reads $HOME/.ackrc but not the project-local ./.ackrc.

It turns out it is quite easy to do it yourself by creating a simple shell script wrapper and then aliasing the ack command:

if [ -f ./.ackrc ]
  ackrc=$(tr '\n' ' ' < ./.ackrc)
ack $ackrc $*
# ~/.bashrc
alias ack="$HOME/bin/"

That’s it! Now I can create a .ackrc file at project root like this:


Now using this technique, one can easily create a wrapper than reads both $HOME/.greprc and ./.greprc and you get Ack’s functionality in grep! Now you wonder if we really need Ack at all 😛

Published by kizzx2, on July 11th, 2012 at 9:36 pm. Filled under: UncategorizedNo Comments

No comments yet.

Leave a Reply