TextMate tip: Open in Finder
If you like working with your documents on the command line, I’m sure you’ve learned to love ⌃⇧O. This will open a new terminal window in the current document’s folder, ready for you to pull out your terminal-fu. Sometimes, however, you’d like to reveal the file in the Finder. I got this very simple script from Malesca
- Create a new command
- Save → Current file
- Key equivalent → ⌃⇧O
- Input → None
- Output → Discard
if [[ -d $TM_SELECTED_FILE ]]; then
TM_PATH="$TM_SELECTED_FILE"
elif [[ -f $TM_SELECTED_FILE ]]; then
TM_PATH="`dirname "$TM_SELECTED_FILE"`"
else
TM_PATH="`dirname "$TM_FILEPATH"`"
fi
open "$TM_PATH"
Now if you press ⌃⇧O you’ll be prompted to open in Terminal or open in Finder.
Make sure you check out my other TextMate tips, and don’t forget to visit Malesca and check out his TextMate tips too.