The Ruby on Rails and ClojureScript experts

Aug 6, 2008

Yesterday Trevor mentioned the Ack TextMate bundle he developed to provide better “Search in project”. I installed it and was instantly sold:

  • search is much faster using ack
  • the results list pops up instantly with the first hits, and then it just keeps growing as you start reviewing the results
  • it has an option to show context around the results (see screenshot below)
  • you can customize the search behavior on a per user or per project basis using a .ackrc file
  • it has an option to follow symlinks. Useful for me because I symlink rails into vendor for my apps. Normally I don’t want to include the rails source in my project search
  • search is limited to currently selected file/folder and its children. Useful for scoping searches.
The Ack results list showing context

The Ack results list showing context

Trevor also provides a screencast that highlights features and usage.

Installation

cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/protocool/ack-tmbundle.git Ack.tmbundle

Custom .ackrc file

By default ack does not search all file types related to Rails projects. So I added some extensions using the ~/.ackrc file:

--type-add=ruby=.haml,.rake,.rsel

You have to tell ack to consider the .ackrc file: In the search dialog, open advanced options and check the corresponding check box.

Thanks Trevor!

Update 2008-08-24: Updated the screenshot with the ‘default’ Textmate theme which looks a lot nicer. Update 2008-11-08: Added example .ackrc file