1

Say, I have two windows, each containing several open tabs, and I want that "structure" to be viewed as one – either a project or a workspace, I do not care. All I want is to be able to close and then re-open both the windows via a single "open" operation.

As far as I understand, usually a workspace corresponds to one window (possibly with multiple tabs); on the other hand, I've seen it mentioned several times that multiple workspaces can correspond to the same project (file).

How do I achieve that?

If I try to add a new workspace to an existing project via Project → New workspace for project, that seems to work at first, but then if I, say, close the project, close the editor, open a new empty window and use "Open project…" – I end up with just one of my two windows re-opened.

The created .sublime-project file is essentially empty: all it has is "{}". What shall I place there to have two workspaces associated with that one project?

Thank you!

curious
  • 11
  • 2

1 Answers1

0

Project or workspace in sublime is essentially about paths, for saying if you are working on the a project in /depot/project_a/..., you can set up a sublime project under /depot/project_a/project_a.sublime-project, then in that project you add "." as your folder. then you can set up another sublime project under /depot/project_a.sublime-project and add "project_a" as your folder in that second project. Sublime text will recognize them as different project although they are literally the same one. Then you can have 2 windows on the same project but have their own files opened. I help I explain clearly and it will help you.

Jimmy liu
  • 1,587
  • 1
  • 13
  • 14
  • I never used folders before, and frankly, I still do not get the idea of having folders as "active elements" of every instance of a text editor (I can imagine some very special situations where that would be needed, but why there should _always_ be some associated folder I cannot see). In any case, I tried to play with folders and still could not get the desired behaviour: having 2 windows with 3 tabs each with the ability (a) to close them with a single "close" operation and (b) to re-open them with a single "open" operation. – curious Jun 26 '20 at 02:59
  • Oh, if you want close/re-open 2 windows with one single operation, then you might need some hack to do that, because that's not the way how Sublime text was designed. You can write a script in like .bat or python or I think basically any scripting language would work to achieve that. And put them in automation process your system, windows has windows search for quick searching your script and mac has built-in automation. It's a bit of hack, but I think it would work. Although I couldn't understand why you would choose work like this. – Jimmy liu Jun 26 '20 at 11:56
  • Jimmy, thank you! Sorry, I seem to be unable to vote for your answer, as there are some weird "reputation restrictions" on this site (and I'd rather not mark my question as "answered", as there seems to be no ready answer). So, this was just my misunderstanding of the concept: I viewed a "project" as a synonym of a working environment (which may contain several windows). Of course you are right that my description of "closing then opening" was somewhat unnatural: what I really want is a simple way of switching between several "environments" that correspond to different projects I work on… – curious Jun 26 '20 at 14:25
  • If you want to quickly switch between different projects, Sublime text provides a "Quick switch projects..." function that allows switch projects you recently opened with Sublime. I used that feature all the time, "Ctrl+Shift+n" to open a new windows then "Ctrl+Alt+p"(which I bind to quick switch project). Boom! you have another project opened without touching your mouse :) – Jimmy liu Jun 27 '20 at 02:39
  • Thank you, that is what I am using too, and it works only "per window": this was precisely what I wanted to improve. You are right that it would be easy to accomplish via a simple (ST-integrated) python script, but I'd rather stay with the existing set-up and switch things "per window", not to cause additional violations of Occam's razor: after all, most of the time it is indeed one window per a project :) – curious Jun 27 '20 at 08:26