TextMate — the missing editor for Mac OS X

TextMate has the regular Open Recent menu showing you the last 25 files you opened (depending on your value of NSRecentDocumentsLimit.)

But some users prefer a menu just for their projects. Currently there is no such menu, but this is where smart folders enter the picture, and possibly Dashboard.

Smart Folders

Creating a smart folder is simple. From Finder you select New Smart Folder (⌥⌘N) from the File menu.

It will open an almost blank Finder window where you need to change the pop-up following Kind from Any to Others… and then enter “TextMate project” (I recommend you paste in the document type, since typing into the kind string triggers some sort of incremental matching which caused my Finder to be unresponsive for minutes.)

After this the Finder window should show you all TextMate project files in your home folder. You can restrict the search location e.g. to a projects sub-folder or similar.

Terminal / Shell

You can run a Spotlight query from the shell (which is what underlies smart folders.) To replicate the above query we would do:

mdfind -onlyin ~ 'kMDItemKind == "TextMate project"'

This returns a list of all your TextMate projects, also restricted to your home folder.

9 Comments

For some time I have been using Spotlight to add TextMate projects to the list of links for (shameless plug) Sundance, my version of a program similar to Launchbar and QuickSilver. Very convenient way of opening projects!

Once I had all my TextMate projects in a single folder, I created an alias so that I could open any one of them from the command line no matter what folder I was in:
alias tmopen "open -a /Applications/TextMate.app ~/TextMate_Projects/!*.tmproj"
(That's csh syntax. Your shell may vary.)
Now I only need to remember the name of the project, not where I stored it. So I can use mate .cshrc to open a file or tmopen perlproject to open an entire project.

Couldn't you just use NSMenuExtra in a textmate plugin to add a 'Projects' menu. Then create an NSArray of all the files in a specified projects directon and call addItemWithTitle to add an item foreach project in the directory. Then use NSWorkspace to launch it in a textmate project window.

I think ill try that when i get home. But in any case, interesting article.

I use Quicksilver, and have a [normal] folder just for TM project files, which I've added to the QS catalog. I then assign a Trigger for ctrl-opt-cmd-P to bring up QS showing the contents of the 'Projects' folder, which I can then start typing a few characters to find the project I'm after, just like how you'd use QS to search for an application to launch normally.

I use QS as well, but I added a spotlight query to it's index, and not the entire projects folder I use. So when I want to open a project, I can invoke QS type a few names, or i I can't remember, just call for the project source item and arrow through them. This is also handy because I use (covers face) Komodo and can list all my project files at once.

This is a bit off the topic, but I was wondering if there was any way to have 'smart groups' within the project sidebar? I am imagining something similar to 'smart playlists' within iTunes. This would be handy when writing LaTeX for example because of the number of ancillary files that are created during the build process. It would be nice in this case to have smart groups which would gather the .tex files and/or the .pdf files for one.