Restore closed window?
-
I dragged a tab from my main N++ window to create two different N++ windows. I then accidentally closed the main N++ window with all my (unsaved) tabs. I still have the ‘new’ window open. Can I get the closed one back somehow? If I do CTRL-SHIFT-T it only opens closed tabs on the new window I opened. None from the main window.
I had ‘Remember current session for next launch’ enabled but backups were disabled. I haven’t tried closing the new window too as I expect opening N++ again then will just reopen the ‘new’ window.
-
You are a little unclear in your phrasing. You mention unsaved files, but say you only have “remember current session for next launch” but “backups were disabled”. If by “backups” you mean “backup on save” feature, then that’s not a problem. If by “backups” you mean “Enable session snapshot and periodic backup” was disabled, you’re out of luck.
Since you don’t mention that closing Notepad++ asked you to save the unsaved files (which it would have done if you had “Enable session snapshot and periodic backup” turned off), then I am hoping for your sake that it was really on. If it was, then there’s still a chance of recovering, depending on what you’ve done since then:
Assume instance-A of Notepad++ had unsaved files
new1
,new2
, andnew3
; and instance-B of Notepad++ hasnew1
. At this point, if you closed instance-A, it wrote the current session file to%AppData%\Notepad++\session.xml
(🛈). If you have done anything in instance-B that would write the session.xml (exiting would do it; but maybe something else as well), it would have overwrittensession.xml
with the new data – at which point, the instance-Asession.xml
is gone, and half of your possibility is gone. However, because you did not ever technically close those unsaved files, the chances are that the periodic backup files still exist in%AppData%\Notepad++\backup\
The steps I would take, assuming you haven’t closed
instance-B
in the last day:- You could try File > Load Session, then go try
%AppData%\Notepad++\session.xml
– it might reload your unsaved files at that point - If it doesn’t, try File > Open, then
%AppData%\Notepad++\backup\
and open all the files in that directory; for your sake, I hope those files exist.
Then, I would highly recommend you save the files to a known name. If you are unwilling to do that, then I at least recommend you install AutoSave plugin (Plugins > Plugins Admin and install AutoSave), then configure it to do AutoSave of your unnamed and named files (this recent post describes how the various AutoSave settings affect its auto-saves and backups – if you don’t configure it, AutoSave defaults to doing nothing, so just installing the plugin is not sufficient to get AutoSave protection).
- You could try File > Load Session, then go try
-
@PeterJones said in Restore closed window?:
this recent post describes how the various AutoSave settings affect its auto-saves and backups
I had forgotten that I had converted that to an entry worthy of a FAQ, but never posted it.
So I did another read through, and then posted it as a FAQ. The FAQ version is a bit more generic than the reply I previously linked to. -
I found a bunch of files in backup folder so I was gonna try opening those. But now when I reopened N++ (after I had closed instance-B as well), everything from instance-A returned (!). So I guess I hadn’t done anything in session-B after I closed session-A. I exited session-B via File - Exit but apparently that didn’t overwrite session.xml. Phew. Installing AutoSave now. Thanks for the help! :)
-
4 years later, and option 1 just saved me some grief.
I had 2 sessions open and autoindent started misbehaving, so I closed the window in which I had about 40 files open, and realized it, just too late. Re-opening one of the files, of course, opened it in the other session, where I had 1 file open. Luckily, the session.xml file had the large session, so all is good.
It’s not that my files were unsaved, it’s just that the session was set up in a convenient way for the work that I was doing.
Cheers for a helpful solution!