Sublime Forum

Open Recent -> Reopen Closed Window

#1

SublimeText already has the menu item File -> Open Recent -> Reopen Closed File.
Also Sublime Text has the ability to save and restore all its open Windows when it is exited via File -> Exit.
If, however, a Window (with a lot of opened files in it) is closed while there are more open Sublime Text’s Windows, the just closed Window seems to be lost forever (with all its open files).
There should be a menu item File -> Open Recent -> Reopen Closed Window that would remember e.g. last 10 closed Windows (with all files opened in those windows).
Frankly, I don’t know why such an obvious feature is still not present in Sublime Text.

3 Likes

#2

With projects (saved to disk) and the quick project switcher (in the project menu, bindable to a Ke sequence), I haven’t had a need for this so far. It probably wouldn’t hurt to add it, but try doing that first to see whether it helps in your work flow.

0 Likes

#3

Thank you, FichteFoll. With saved project file it is indeed much better since a saved project seems to automatically track which files are opened/closed in it, without the need to update the project manually.
If, however, I mistakenly close a window full of open files without saving them as a project, I feel really stupid and doomed. And it can not be undone!!!
So indeed an ability to Reopen Closed Window would be something “parallel” to the idea of a saved project. And it would perfectly match into the existing functionality of

  1. Undo (the level of symbols)
  2. Reopen Closed File (the level of a complete file)
  3. the proposed Reopen Closed Window (the level of several files in a window)
2 Likes

#4

I agree! I had a separate window open for just sandbox stuff… another window was my project files. Right now, I’m trying to restore the sandbox files in the window that closed when storm here crashed us… Was hoping for a “secret” keyboard command… ah well… :frowning:

0 Likes

#5

I was really hoping to see this feature in new version of Sublime Text… Now the new version is here, the feature is absent :frowning:
Please add it to the new version!
If it matters, I’m a registered user…

0 Likes

#6

Another use case, I’ve encountered a bug several times (though infrequently) where a git diff doesn’t open in a new window, but in my main editor window, and if closed, takes the whole rest of the window with it.

0 Likes

#7

Related issue (not exact, but related):

0 Likes

#8

Any comments from the developers, please?
I still have high hopes to see this feature in Sublime Text!

0 Likes

#9

+1, agreed, if you can re-open closed tabs it makes sense to also be able to re-open closed windows.

An alternative would be some sort of session management package that auto-saves your state (the way Session Buddy does for Chrome even if Chrome crashes and doesn’t recover its state). But, yeah, ideally Sublime Text would take care of this itself without a separate package.

Next time you accidentally close a window like this, you can also try restoring the auto-saved session:

  1. (Window is accidentally closed)
  2. Keep ST open (don’t close/exit)
  3. Copy “…\Local\Auto Save Session.sublime_session” file to another location
  4. Close ST (File -> Exit)
  5. Copy “…\Local\Session.sublime_session” file to another location too (to backup your current state, just in case)
  6. Copy the “Auto Save Session.sublime_session” back to “…\Local”
  7. Launch ST; if the lost window was auto-saved it should re-appear.
  8. If you don’t like what was restored, close ST, and copy the “Session.sublime_session” backup back to the “…\Local” folder.
1 Like

#10

Sublime Text 4 is here and the “Reopen Closed Window” feature is still not here :(((
Come on, could it be that you never ever ever use a temporary New Window when you modify some files outside of any project? And once you close this window, you immediately realize that you need to do something addition with either all the files from this closed window or with at least some of them? And inability to re-open these files (they are not present even in the recent files list) is just so sad! And it does not really makes sense to save all these files as a project because it is just temporary work that you do once - and that’s all.

1 Like

#11

This topic had been created in 2018; then a similar (related) issue has been created on GitHub in the end of 2019.
Still no updates from developers.
Please don’t get me wrong, but this situation:

If, however, I mistakenly close a window full of open files without saving them as a project , I feel really stupid and doomed. And it can not be undone!!!

should not exist in a mature and non-free text editor.

Either of these options is a must:

  • when a window is closed, there should be ability to reopen it
  • when a window is closed, the files from that window should be present in the Recent Files List.

Sublime Text proposes neither of the two, though it already has a mechanism of saving its windows on close and restoring them on start.

2 Likes

#12

I would also like this.

I just tried to close a flie with Ctrl+w, but accidentally caught the shift key too.
Ctrl+Shift+w closes the window, and now I am unable to reopen it.

0 Likes

#13

Lesson Learned
Always safe to a workspace or project if you have lots of windows opened, so that you won’t get upset by Sublime.

0 Likes

#14

I don’t know how well the save project feature works. In my own case, I wanted to update to a new version but the auto-updater kept failing to properly shutdown the existing one. It was throwing errors about file being in use. As was advised on another thread, I installed a fresh version but needed to restore open tabs from the older version

What worked for me was terminating the sublime process via task manager, then opening the new version (4). Thankfully, new versions use the data folder of any existing version they find. I guess this is why the new version was able to read and restore all those files open in the previous one

EDIT: Like I said, I don’t know whether saving to project made a difference. I combined both to get desired result

0 Likes

#15

Just for information, now Sublime Text shows me “License upgrade required” and I am not going to pay a cent until the “Reopen Closed Window” feature is implemented. I feel it is the only way to motivate the development in this direction.

0 Likes

#16

Maybe another workaround would be to change the binding for window closes to first save the session for the window and then to close it. I haven’t tested this but a package like https://packagecontrol.io/packages/SimpleSession gives you commands that you could bind to do this.

0 Likes

#17

I’ve noticed that the Build 4142 (November 2022) contained a pretty interesting change in this direction:

The recent file list is now global instead of per window

Well, it’s not “Reopen Closed Window” yet, but at least it avoids complete despair when you want to reopen a file from a closed window: now this file is present in the Open Recent list.
I’m happy it took only 4 years (since July 2018 when I proposed to have Reopen Closed Window) to implement at least this! Anyway, it’s much better than Microsoft that required 20 years to support file paths more than MAX_PATH=260 characters :slight_smile:
So I’ve upgraded my license to appreciate your work, guys.
Greetings from Ukraine!

1 Like