Sublime Forum

Session management and unsaved files

#1

I have a problem with session management and ST (tldr below). I am using the application in a bit of a peculiar way, as I have lots of unsaved open tabs which I am using sporadically as pasteboard for files (JSON, Turtle, XML) or little scripts which I am not interested in saving (as I am using them in other applications). ST is the place where I can paste large files, analyse them, do some small modifications, and move on.

However, I do not want to close the tabs immediately, as I am using them across different projects and need to come back to one file and re-check it, extract something else etc.

As you may imagine, the tab list become quite unmanageable after a while, and it would be great to have a way to save a set of opened tabs and come back to it later in the day (or the next day). However, any solutions (SessionManager or Projects for example) I find implies that the tabs I opened in ST are already saved in the disk. I would like to avoid that because (i) takes too much time to save everything and (ii) I will not need that content after a few days.

tldr: tons of unsaved tabs, need to quickly save them all using a session manager and restore them when needed.

Do you know of any easy solution to the problem?

Ideally would be great to have something that allows me to save a work session comprising a number of opened (and unsaved) tabs. Alternatively, something that can help me save all the tabs in a window in a very quick way.

Thanks in advance

0 Likes

#2

Why not use File -> Save All ?

0 Likes

#3

Because it requires to save each file one by one, which is gonna take quite some times for a long list of open tabs (>50). A bulk save all would be best

0 Likes

#4

The default value for the hot_exit setting in Sublime is such that quitting Sublime and restarting it will restore the state of all windows back to what it started as, including any files that were open and restoring any unsaved changes.

So, at a base level all you need to do is quit Sublime and restart it to get things back, with no extra packages or anything required (note however that closing a window and quitting Sublime aren’t the same thing)l

If you have just a single window dedicated to such files and you’d like to close it and recall it back later, then while you’re inside that window, Project > Save Workspace As... and create a file named Scratch File Window.sublime-workspace or similar somewhere (can be anywhere).

Now this window has it’s own dedicated workspace, so you can close the window with impunity; you won’t be prompted to save anything, and the state of all files will be stored in the workspace file. At any point, the items at the top of the Project menu (Open Project, Switch Project, Quick Switch Project, Open Recent) can be used to find and open that workspace to bring everything back.

The items with Switch in the name will swap the content of the current window with the chosen file, so usually the workflow would be to create a new empty window first.

This is demonstrated in the following video:

2 Likes

#5

But File -> Save All is a bulk save operation. It should save every file in the current window.

0 Likes

#6

When the files are unsaved it needs to prompt for a path for each file.

1 Like

#7

Ah, right. I was confusing it with saving changes in existing files.

0 Likes

#8

Great, that solve it. I was trying to close each tab, while closing the window was the obvious solution! Thank you very much

0 Likes