Henrik pointed out that ack was not searching his ‘haml’ files. This is because ack doesn’t recognize .haml files as interesting so it skips them. Adding a new filetype to ack is simple but non-obvious.
For example, to tell ack to recognize haml files as ruby sources while searching for ‘some_text’ you would do this on the command line:
ack --type-add ruby=haml some_text
Permanently adding haml as a type requires that you put that —type-add into a .ackrc file. I’d recommend you put it into your $HOME/.ackrc file rather than in a per-project .ackrc because adding haml as a file type is probably something you want across projects.
The only niggle is that —type-add is actually parsed as 2 arguments in sequence, not one argument. So you can’t put them all on one line.
Here’s my suggested $HOME/.ackrc file:
Update: Ack wasn’t searching my rake and selenium files, so I tried the below to add them to the list of searched file types. Here is what I put in my ~/.ackrc:
Note that I had to add the period to the extension, and I put everything on one line with an extra ‘=’ sign.
Remember You have to enable ‘Load defaults from ~/.ackrc’ in the advanced options.
The handling of the .ackrc should certainly be DWIMmier, and it’s in the to-do list.
If you really want to search in any filetype instead of adding the above to .ackrc just add this:
# Search all files -a
That will search all files.
If you cannot find any files at all please make sure that ack-standalone.sh is executable.