Quick Textmate tip
May 25th, 2007
For all those people making Rails apps in Textmate, here’s a little thing that I’ve suggested to other people in the office recently. It affects people like me, who generally cd into my rails app and run mate . to open up the entire thing in everyone’s favourite editor. The problem in this situation, which most of us have encountered at one point or other, occurs when doing a find in project. There is a certain sinking feeling you get as you press the find button, and at that exact moment, realise that the log and tmp directories (which have been accumulating in size over the last month) are gonna be searched as well. The ball starts spinning and there’s nothing you can do…
One solution to this is to remove the directories manually, and optionally save the project for the future. But that is boring, and can lead to mistakes. Enter neato trick in the form of folder references. If you go to Preferences > Advanced > Folder References, you can see the regular expression in the second box for folders that TextMate will ignore.
If you change it to this, your log directory will be ignored automatically:
!.*/(\.[^/]*|log|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
If you are feeling Spartan, you could also add sessions, cache, rails and anything else you don’t search often which that slows search down.
I hope this is helpful to someone, it seemed rather obvious but overlooked feature to me.
6 Responses to “Quick Textmate tip”
Sorry, comments are closed for this article.






Yes! This is actually exactly what’s been bugging me of late.
Thanks a lot.
Interesting tip. To solve the same problem, I have a bash alias called ‘mater’ that only opens the dirs I care about:
alias mater=’mate app config db lib public test spec’
drop that in your .bash_profile and you should be good to go.
An interesting take on the problem Brian.
Out of curiousity, was the alias designed to sound maternal, or was “r” just a random consonant you chose to prepend to it? :)
Heh. The ‘r’ is actualy for “Mate Rails” :) But I pronounce it as “Mater…Like Toww-Mater” (My kids watch “Cars” almost daily) :)
Thanks for the tip, I’ve been doing this as well. The problem I find is the regex uses the full path for the files, not the path within the scope of the opened project. This means if you try to open, say, edge rails which is in your vendor/rails directory in a separate window in TextMate, it won’t show any subfolders because the full path still matches the regex filter. Anyone know of a solution to this?
Fantastic. I have been suffering the slow search for months. Thanks Max.