iA


Better TextMate search: Ack in project

by Jo Hund. Average Reading Time: about a minute.

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

3 comments on ‘Better TextMate search: Ack in project’

  1. Jeff Ward says:

    This is great, I installed it and I love it. I have been using RubyAMP (http://code.leadmediapartners.com/tools/rubyamp) and basically only using the “Grep in Project” functionality for the search (which ignores log files, etc) but I’m definitely going to give this a true test. So far it’s great. Thanks!

  2. Hey Jo,

    thanks for the shout-out, had a great time last week.

    By the way, the html output looks much better with the ‘default’ texmate theme (top right hand drop-down box in the html output window).

    Trev

  3. [...] In Project for all my project-wide searching needs, incredibly fast and dynamic results, with a custom .ackrc file. (Although this has now been supersceded by [...]

Leave a Reply