Textmate has no split windows, and you can't open the same file within a project in a new window without resorting to using the mouse. Here's what I mean:

textmate open in new window

Situations often arise where you have to refrence one file while editing another. Maybe you want to view a header file while editing its implementation code. Or maybe you want a TODO list in one window while working on the rest of your code base.

In these scenarios tabbed editing becomes extremely painful, and the alternative of mousing around to open a new window has always felt like a clunky solution to me. Here's a hack to create a keyboard shortcut for opening files in new windows. Oh what a hack it is:


tof=`echo $TM_FILEPATH`
echo $tof

mate "$tof" .RANDOM_STRING_DOES_NOT_MATTER && osascript <<EOF
tell application "System Events"
    delay 0.2
    tell application "TextMate" to activate
    keystroke "t" using {command down}
    keystroke return
    keystroke "d" using {command down, control down, option down}
end tell

To use this, create a new bundle command, add this code to it, and associate your keyboard shortcut to the command.