DaveSouth.org

Email RSS Twitter Delicious

Speed up “Find in Project” in TextMate

TextMate’s very useful “Find in Project” is super slow for any decent Ruby on Rails application. The problem turns out to be very simple. TextMate searches the entire project tree including the tmp and log directories. It takes a lot of time to dig through those directories — especially the log directory which can quickly become many megabytes in size. Not only that, rarely do we want “Find in Project” to return results from these directories. The solution is simple.

Open TexMate Preferences (command-,) and open the Advanced (gear) tab. Click “Folder References” and on the line “Folder Pattern” add “tmp|log|” just before the “CVS” entry. My folder pattern looks like:

!.*/(\.[^/]*|tmp|log|coverage|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$

I added coverage so TextMate wouldn’t return results from the rcov generated reports.

Now open your Rails project and try a “Find in Project”. The speed difference went from very slow to almost instantaneous. If you are running Rails Edge attached to “vendor/rails” you may want to add rails to your Folder Pattern, too. It will save a lot of time.