Sublime Forum

What happens if I have two Sublime windows open?

#1

I can’t remember how it happened – I think I was toying around with the concept of Projects (which I still don’t understand) – and in doing so, it opened up a duplicate Sublime Text window. In a bit of oversight, I’ve left it open, and unbeknownst to me, I’ve been creating new files and updating old ones in both Sublime windows over the course of a few days.

So now I’m in a bit of a pickle – in order to use Sublime’s caching of open files (so that everything restores, even unsaved files, when Sublime opens back up), what do I do with these windows? I’m guessing that the last window to be closed will be what gets restored when Sublime opens back up. I tried editing the same file that’s opened in both windows, wondering if it would ‘live’ update the other instance, but it did not.

Is there something I can do to merge the files (I’m guessing that’s not going to work)? Is there a way to have all the new/unsaved files in the separate windows be restored with Sublime after exiting and restarting? How is Sublime interpreting this situation currently?

0 Likes

#2

Sublime lets you open as many windows as you like. Press Ctrl+Shift+N to open a new one, or via the menus, go to File, New Window.

You can also open a new window by dragging a tab off of the main window and dropping it on the desktop (now fully working, yay!). A new Sublime window will be created where you drop the tab.

Once you have multiple windows open, you can drag tabs back and forth between them.

So once you’ve got a group of files in one window and you want to keep that grouping, save it as a project (Project, Save project as). Then you can reopen that window with that group of files by using Project, Open project, or Project, Recent projects.

You are correct that Sublime will restore the files from the last closed window, but using projects means you don’t have to worry about what order you close things. Sublime will reopen the last closed project also, but you can then reopen any project as mentioned above.

When Sublime saves a project file, it also saves a workspace file that records the open files and the window positions, so all of this gets reloaded when you reopen the project.

Also, if you have the same file open in two different windows, once you save changes in one, you should see them show up in the other.

0 Likes

#3

Wonderful, thanks for detailed help! Great to know all of that awesome functionality that I didn’t know before!

Makes me want to high-five Sublime the next time I open it!

0 Likes