do you know how can one in Textmate open several windows for the same file?

So I can at the same time look and compare different parts of the same file.

  • 1
    I don't think that's possible with TextMate. Maybe it's just quicker to copy everything, open a new window and paste everything - that's three keystrokes. – slhck Sep 6 '10 at 19:31
  • @slhck: It's four ;) Command-A, Command-C, Command-N, Command-V. – Wuffers Nov 7 '10 at 23:27
  • Haha, my bad, you're right of course. – slhck Nov 8 '10 at 9:44
  • 1
    Soon to be possible in TextMate 2 – bobobobo Apr 13 '13 at 19:38
  • yes because we need it , please – Open the way Apr 14 '13 at 9:48

Quick AppleScript to do the copy-paste-etc. operation in sequence:

tell application "TextMate"
    tell application "System Events"
        keystroke "a" using command down
        keystroke "c" using command down
        keystroke "n" using command down
        keystroke "v" using command down
        keystroke "a" using command down
        key code "55"
    end tell
end tell

Basically it executes Select All, Copy, New, Paste, Select All, Up (the last two commands bring the cursor to the top of the newly duplicated file). The new file also will not be syntax-highlighted until you explicitly set the language; that may help distinguish between the original and the duplicate.

In a more advanced version, you could actually grab the filename, duplicate it to a temporary location, and then open it, but then you'd have to maintain the two versions and there's a risk you would modify the duplicate without realizing it.

Hope it helps.


While having the original file open in TextMate, open another instance of TextMate from Terminal

open -na TextMate FILEPATH

This way you'll have two separate instances of TextMate in which you can read and edit the file from two different windows.

EDIT: I wrote "two", but you can actually open as many instances as you want.

  • 1
    TextMate prevents that. It's one of the applications open -n fails on. – Daniel Beck Apr 16 '11 at 4:52

If you are working in a "project" you can right-click on a file in the drawer and open it in a new window.

Both "views" are going to stay more or less in sync but complex manipulations can somehow break synchronization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.