http://clearcove.ca/wp-content/themes/press

06 Aug 2008, Posted by Jo Hund in Software, Tools, 2 Comments

Better TextMate search: Ack in project


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

2 Comments

August 7, 2008 4:26 pm

Jeff Ward

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!

August 10, 2008 11:48 am

Trevor Squires

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

Posting your comment...

Leave A Comment


Subscribe to this comment via Email