Sublime Forum

Not understanding New Window

#1

Using Sublime 3, I have a single window open for a project. When I open new window, I don’t appear to be associated with any project. That’s fine. But then, while I’m in the new window, I should be able to open the same project that I have open in the first window.

Similarly, I start with a single window with a project open. I drag one of the tabs out to be its own window. Shouldn’t this newly created window still be part of the original project? Yet, when I try and Go To File with this new window in focus, I only see one file in the search results.

Am I missing the workaround here? Is this the expected behavior? I want the new window to just be a new view into the project; just like a new tab is.

0 Likes

#2

This is unexpected behaviour, in my opinion, and there is no workaround that I know of, other than creating two duplicate projects.

0 Likes

#3

…or maybe two workspaces for the same project?

0 Likes

#4

I’ve found this annoying at times.

As I understand it, Sublime’s workflow is presently project-per-window. Sublime remembers everything about the window workspace for the project automatically. Trying to open the same project in multiple windows contradicts the paradigm, hence the problem.

I actually like the project-per-window approach, and I love how sublime handles everything seamlessly: when you close the window, the project’s state and workspace is saved out automatically. This rocks.

However, there’s room for improvement, especially in the case where several windows are used to spread code across multi monitors. The simplest approach would simply be a “new window with current folders”: the new window’s not part of the project but functionally you’d get about 70% of the benefit (go to anything, search open folders etc.).

A more powerful approach would be to support multi-window projects: the sidebar would be mirrored for all windows part of the project, and “Groups” (panes) would now appear under “Windows”. Files could be easily moved between groups or windows using the sidebar or the current drag and drop approach, but “Groups” could also be dragged between windows. Windows that are part of the project are saved when the project is closed.

For now I’ve adapted to the restriction: I have my main “project window” whose state and workspace I want saved, and auxilliary windows for my current work session. At the end of my work, anything important in those windows I drag over to my main project window before shutting sublime down - and everything else can be discarded.

:smile:

0 Likes

#5

I just gave up and adapted to using a couple of panes within the project window for the situation of dragging between open files.

I use cmd-P to re-open files within the project, and Advanced New File to create a new file within the project, and just never leave many files open, since re-opening them with cmd-P is pretty darned fast.

Typically, if I want to create a file OUTSIDE the project, I’m launching ST3 from the command line. But yeah, that part could be smoothed out a little.

0 Likes

#6

If you have your current session saved as a project, you can just use the “New Workspace for Project” menu item. That does mostly what I want.

However, if you launch Sublime like I do most often using subl from command line, you don’t actually have a project. You just have a bunch of folders in the workspace.

So to try and solidify my understanding:

  • Workspace = currently open folders in a given window?
  • Project = saved Workspace?

So this could be solved a couple ways:

  • I could also open a project instead of a workspace. Then “New Workspace for Project” would work as I wished.
  • A new action “New Window for Workspace” could be added that duplicates my workspace (set of open folders) in a new window
  • When dragging tabs from current workspace into a new window, the new window should inherit my workspace.

Last one would most certainly require change in Sublime. Second one could probably be addressed in a plugin, but I’d have to dig into the API.

0 Likes

#7

This is interesting, at least for the project I am working on.

So what exactly is the difference, as far as Sublime is concerned, with the following scenarios:

A project with 2 files open in a single column layout - top file in current buffer and bottom file in previous buffer
or
A project with 2 files open in a 2 column layout - with either file in the current buffer and the other in the previous
or
A project with 2 files open and one file is dragged out to make a new window
or
A project with 2 files open, one in the original window and the other in the window from the “New Workspace for Project” command?

There must be some underlying difference in the way the main program views each of these scenarios, otherwise there would be no difference in the way they are handled.
But what is that difference?
I’m currently porting to version 3 the WinMerge plugin, and previously the 2 last buffered files, whether in a single/double layout or 2 windows, were parsed as the criteria to start the WinMerge comparison. But if the ability to change the internal recognition of each view is available, that would be helpful to know.

Or is this all just to do with how the project is handled?
I would like to know either way.

0 Likes