TextMate News

Anything vaguely related to TextMate and macOS.

Smart Folders for TextMate Projects

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.)

Finder Smart Folder

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.

I am mentioning this only to bring you to the next section.

Dashboard Widget

Eric Coleman wrote a Dashboard widget which presents your project files by using the shell’s capability to run a Spotlight query.

Anthony Underwood improved the widget to have a nicer look. Here is a direct link to download the widget.

And here is a hint about how to get Dashboard widgets shown on your desktop.

categories TextMate Tricks

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!

24 June 2006

by Christian Bogen

LaunchBar does something like this too via its “Items grouped by kind” feature.

24 June 2006

by Michael Friedman

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.

You can also do this very easily with Butler. I have it set up to show a popup list of all my tm projects with ctrl-opt-w from anywhere: I explain how and even have a snazzy screenshot here:

http://brainfag.com/writing/131/#butler-and-textmate

03 July 2006

by Matt Tavares

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.

Thanks for sharing! One question about the dashborad widget though: How can I prevent the listing of TextMate project files which (already) went into t.Trash?

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.