2

Is it possible to reopen mistakenly closed file in Notepad++ using keyboard shortcut (Ctrl + Shift + T). Most web browsers have this feature, if you close a tab by mistake.

Can we do that in NPP too?

5

As a matter of fact, Ctrl+Shift+t reopen last closed file in Notepad++ (version 7.6). But the file must be named (this shortcut do not work on new 1 and similar files).

4
  • Thanks. I am stuck at the older version of Notepad++, due to some admin restrictions. Is this functionality possible in the older versions ( I am still at v6.5) – NotepadPlusPlus PRO Jan 4 '19 at 15:56
  • @Cricrazy, unfortunately I can't get older version. But you can try to map a key (if you see it as function). Or maybe try new version with portable apps (do not need install) – Romeo Ninov Jan 4 '19 at 16:30
  • 1
    I don't have a copy of NPP that old right now. To determine for yourself whether the functionality is there, look at File menu, and see if the entry Restore Recent Closed File is there; if that's lacking, maybe Open All Recent Files. If it is there, but doesn't have a keyboard shortcut, you can use Settings > Shortcut Mapper, as @Romeo-Ninov suggested. – PeterCJ Jan 29 '19 at 18:58
  • @Cricrazy use the PortableApp version instead. That's recent enough to have this shortcut. – Nelson Mar 14 '19 at 1:25
2

If you do not have it setup already, you can have notepad++ "save" files automatically into notepad++ in case notepad++ gets closed or computer shuts down.

You will go to Settings -> Preferences -> Backup -> Enable session snapshot and periodic backup

At this point you will be able to close notepad++ and if you open it back up your files that you had open will still be there. You can also shutdown your computer and open notepad++ backup and your files that you had open will be there.

Also like what Romeo mentioned, you can press control + shift + t, and it will open your last txt document, but it will not work for unsaved txt documents.

Snapshot

0
1

After my comment earlier today, I found a bit of time and downloaded a portable v6.5 (from Sept 2013). It has that functionality, kind of, though under different names.

Once you close one or more tabs, the File menu will have a list of most-recently-closed files. You can click on the appropriate number, and it will re-open that file. So the keyboard sequence Alt F 1 (a sequence, not holding them down) will open the most-recently-closed. It's not quite as simple as Ctrl+Shift+T, but it's the same number of finger-presses. And just below that, Open All Recent Files will open all the recently-closed files. Unfortunately, neither of those has entries in the Shortcut Mapper... for v6.5.

I tried some experiments: I looked up the MessageID's from 7.6.2, which are Open All Recent Files (MessageID=42040) and Restore Recent Closed File (41021), and compared those to the codes in the 6.5 source code: I found Open All Recent Files was still 42040, but couldn't find an equivalent of Restore Recent Closed File. I tried adding a shortcut for both of those, or for just the 42040, by editing shortcuts.xml in the <InternalCommands> section, and exiting/reloading.... But NPPv6.5 didn't do anything when I tried those shortcuts, and when I exited and reloaded again, those shortcuts disappeared from shortcuts.xml: so NPPv6.5 doesn't want shortcuts for even that known ID=42040.

So, the best I have to offer is to ask your Admin to install a newer version. As the best workaround I can find, use Alt F 1 in sequence.

Hope this helps.

1
  • 1
    Great finding. Thank you. In fact, I can also use ALT + Down Arrow + Number. This also seems to be an option, ALT (with a fraction of sec pause) enables first menu, which is File menu, and then I can pick any number to reopen that file. So, if I closed a file by mistake, I can simply do ALT + DownArrow + 1. A good work around. Appreciate your investigation. – NotepadPlusPlus PRO Jan 31 '19 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.