TextMate "Open Finder" command

Written . Tagged Finder, OS X, TextMate.

TextMate comes with an “Open Terminal” (⌃⇧O) command, in the Shell Script bundle.

This command will open a new Terminal window in the directory of the active TextMate file. Quite handy.

I made an “Open Finder” (⌃⇧O) command to go with it. The command goes into the “TextMate” bundle.

If you have a file open or selected in the project drawer, its containing directory is opened in Finder with the file selected (the OS X term is “revealed”). With a directory, it’s just plain opened in Finder. With an unsaved file, your home directory is opened.

Both commands intentionally have the same shortcut, so TextMate presents you with a disambiguation menu. “Open Terminal” can be triggered with ⌃⇧O, then 1 or T, then and “Open Finder” with ⌃⇧O, then 2 or F, then .

The command is available as a Gist. Download it, unpack it and double-click Open Finder.tmCommand to install.

I think I’ve written a command for this before, but I couldn’t find it, so I made a new one. If you have my old command, it would be interesting to see.