Flaviu Simihaian's Blog - Entrepreneur and Developer

Why Ack Can't Find Some Queries

Ack often regains the attention of HackerNews for being better than grep. They’re not shy either: the ack home page is betterthangrep.com.

I’ve been using ack for a few months, and while it’s awesome, sometimes it can’t find some stuff that I know is in my project. This upsets me.

Come to find out, part of the reason ack is so fast is that it skips certain files (finally read some docs). Most importantly, it skips any file it doesn’t recognize.

So, basically, my .haml, .scss, and .coffee files are not searched by default.

To find out which file types it does search, just type:

1
ack --help=types

I can either add some command line argument to include those files (which I don’t remember), add a -a flag to search everything, or create a .ackrc file in your home folder.

I opted for the latter:

~/.ackrc

1
2
3
4
5
6
--type-set
haml=.haml
--type-set
sass=.sass,.scss
--type-set
coffee=.coffee

Now those files are searched too. Hope this helps another Flaviu out there.

Comments

Fork Flaviu on GitHub