Open recently closed file in Notepad++ using keyboard shortcut

7,066

Solution 1

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).

Solution 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

Solution 3

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.

Share:
7,066

Related videos on Youtube

NotepadPlusPlus PRO
Author by

NotepadPlusPlus PRO

Coder. Writer. Blogger. Tech enthusiast. Notepad++ PRO.

Updated on September 18, 2022

Comments

  • NotepadPlusPlus PRO
    NotepadPlusPlus PRO over 1 year

    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?

  • NotepadPlusPlus PRO
    NotepadPlusPlus PRO over 5 years
    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)
  • Romeo Ninov
    Romeo Ninov over 5 years
    @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)
  • PeterCJ
    PeterCJ over 5 years
    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.
  • NotepadPlusPlus PRO
    NotepadPlusPlus PRO over 5 years
    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.
  • Nelson
    Nelson about 5 years
    @Cricrazy use the PortableApp version instead. That's recent enough to have this shortcut.