Last Updated: February 25, 2016
·
690
· gearheart

Make ack recognize custom file types

ack is a great replacement for grep when working with source code.

It allows to search by all source files in current directory recursively using just: ack funcName. It automatically ignores .svn dirs and other files, which are not sources. Unfortunately, ack will also ignore some useful files, like .less, .coffee and others.

Turns out, you can easily learn it new types of files by creating ~/.ackrc with content similar to:

--type-set=less=.less
--type-set=scss=.scss
--type-set=sass=.sass
--type-set=coffee=.coffee

Now you can search those types with ack and even use flags like ack --less