52

After an unplanned system restart, all of my Notepad++ temp (and unsaved) tabs are gone.

How can I avoid this in future? I don't want to have to save explicitly every single temp file with a file name.

Is there a plugin for NP++, which saves my session every time I'm editing an active tab or every X minutes?

Or is there an equivalent (and comfortable) editor to NP++, which autostores it's session automatically?

MrWhite
  • 43,179
  • 8
  • 60
  • 84
mchlfchr
  • 3,998
  • 4
  • 26
  • 35
  • 1
    see this answer for an alternate solution: http://stackoverflow.com/questions/24081157/how-do-you-keep-notepad-from-opening-unsaved-documents-from-the-last-session – golimar Dec 14 '14 at 15:02
  • I'ts not clear, ypour question is abut saving session (list of open files) or files? – AndriuZ Feb 26 '19 at 05:58
  • If I close and reopen Notepad++ my previous unsaved tabs are still there. Doesn't that work for you? Perhaps when restarting/power off it get cleared, but not when closed? – Santropedro Jul 20 '19 at 22:56

6 Answers6

40

You can find a Notepad++ plugin called AutoSave for autosaving your files here: https://github.com/francostellari/NppPlugins/tree/main/AutoSave

(Used to link to https://sites.google.com/site/fstellari/nppplugins but that's no longer online, cached version is still available here)

It autosaves every minute, but it's configurable, and allows you to choose to save only the current document or all open documents.

mauro_oto
  • 1,368
  • 17
  • 23
  • 2
    Just to note that the version available from within the Plugin Manager (inside NP++) appears to be v1.3, whereas the one directly from the developers website is v1.4 (released 2012-12-11). – MrWhite Nov 04 '13 at 20:31
  • 2
    If you're having problems getting this plugin installed... http://superuser.com/questions/292340/notepad-autosave-plugin-not-working/313290 – MrWhite Nov 04 '13 at 21:58
  • 1
    @mauro_oto, at least from v1.20 ( 2010-07-16) Franco Stellaris Autosave plugin now handles autosave on loss of focus. – holroy Jul 19 '15 at 01:29
  • 1
    To be noted: it's v1.6 on the dev site already (updated in 2017-02-08) – YakovL Feb 28 '17 at 12:32
  • 1
    since Notepad 7.6: FOR PLUGIN USERS: Find the name of plugin you want to migrate in %PROGRAMFILES(x86)%\Notepad++\plugins\myAwesomePlugin.dll (or %PROGRAMFILES%\Notepad++\plugins\myAwesomePlugin.dll, according the achetecture of your Notepad++). go to %LOCALAPPDATA%\Notepad++\plugins\ to create myAwesomePlugin folder. move the plungin myAwesomePlugin.dll from %PROGRAMFILES(x86)%\Notepad++\plugins\ to %LOCALAPPDATA%\Notepad++\plugins\myAwesomePlugin\. That’s it. Restart Notepad++ and you get your beloved plugins back. – mrapi Nov 21 '18 at 06:57
  • I much prefer [this one](https://sites.google.com/site/fstellari/nppplugins) because it has an option to AutoSave every time the window loses focus, so when testing html, etc, I "never" have to save before checking my work in the browser. (The download link on that page is the version number.) – ashleedawg Dec 13 '18 at 19:08
  • 1
    The link in answer in not working , I downloaded from another [link](https://web.archive.org/web/20200603050229if_/https://sites.google.com/site/fstellari/nppplugins) – Arun Jan 03 '21 at 08:58
22

From Notepad++ 6.6 or later there are in core and don't need any plugin.
Via menu => Settings => Preferences => Backup => Enable session snapshot and periodic backup

Nabi K.A.Z.
  • 9,887
  • 6
  • 59
  • 81
  • Very interesting. Only a few files in there, with names e.g. `example.txt@2016-09-30_113259` When does something go in there? – Bob Stein Apr 19 '18 at 22:28
  • I'm having the same thing, seems a bit random what gets stored (mostly nothing). Autosave2 plugin mentioned above works better for me. – Andi Mohr Oct 11 '18 at 12:14
  • 1
    This doesn't actually force the current file to be save to its original location. – Greg Allen Apr 06 '22 at 15:42
15

To date, there are two AutoSave plugins available.

To download, click on the Plugins menu and select Plugin Manager (or Plugins Admin). It will pop-up a window with a list of plugins.

  1. Autosave by Franco-stellari — This autosaves files. Option available to configure timing after autosave, or autosave when npp loses focus.

  2. Autosave2 by www.scout-soft.com - This autosaves files by creating copy of the file. This is useful in case you retain previous saves, such as for incremental development.

Select either of the two AutoSave plugin available and click on Install. If the plugins are not listed, use the links above, and save the .dll to npp's plugins folder according to instructions on the sites.

Update:

in the newest version of Notepad++:

  1. save the plugin's .DLL in Notepad++'s plugins\[plugin name] folder,
  2. go SettingsImportImport Plugin(s)... and select the .DLL you just saved,
  3. Restart N++. The plugin should appear in the "Plugins" menu.
ashleedawg
  • 20,365
  • 9
  • 72
  • 105
Harshal Doshi Jain
  • 2,567
  • 1
  • 20
  • 16
  • 1
    I installed the plugin but I am unable to figure out the location , it saves the file at . Can you brief that ? – 1ambharath Feb 22 '17 at 13:23
  • 1
    A direct link to the second one: http://www.scout-soft.com/autosave/index.html Like devs say, it's more autocopy than autosave – YakovL Feb 28 '17 at 12:35
5

UPDATE 2022

For those who look for answear on similar question, I`ll try to give detailed description.

I`m personnaly use integrated backup/autosave for Notepad++ which, I think cover any needs for this functionality and better option can be only files versioning tools like git/hg etc.

So... Go to:
Settings / Preferences / Backup

This will open settings which containe two section:

  1. Session snapshot and periodic backup
  2. Backup on save

First option in first section is Remember current session for next launch:

After enable this, on restart NP++ will be open all session related instances, like opened files, project in projects panel etc, from previous session. But this may did not help if NP++ for some reason was unexpectedly closed(the process freezes, the power supply of the computer is interrupted, etc.) and as result you lost unsaved state of your files.

To partially protect against such an unpleasant accident, you can use the following option: Enable session snapshot and periodic backup:

After enable this, NP++ will after the interval specified in the option Backup in every N seconds, check all open and UNsaved in NP++ files, and save a copy of them with a timestamp in the file name extension(if in Windows explorer display extensions dissabled you can't see timestamp and see only filename wo extension), to the folder specified in the Backup path option.

d:\Temp\ff_stickers.js
d:\SYNCFOLDER\Settings\NP++\backup\ff_stickers.js@2022-04-19_141352

After you save original file, NP++ immediately delete this backup copy.
Also, enabling this option allows you to exit NP++ without saving opened and unsaved files. When you close the NP++, it does not prompt you to save opened and unsaved files, and the next time you open it, it displays them in the same way as before close - marked as unsaved.

Regarding the option Backup path - you cannot change this path, because it depends on where the NP++ configuration files are stored. By default, this is the folder backup in same folder where NP++ itself is located. In my case (on my screen), this path is located in the same place as the configuration files path, specified in the Cloud option:

Which was added to be able to synchronize NP++ settings.


The next options, already in the second section:
None
Simple backup
Verbose backup

With option Simple backup:

while you save original file in NP++, it will add *.bak file with previous saved state, next to the original:

d:\Temp\ff_stickers.js
d:\Temp\ff_stickers.js.bak

This *.bak remains the only one and is replaced on every save of original file.

With option Verbose backup:

while you save original file in NP++, it will add subfolder nppBackup next to the original file, and save there *.bak file with previous saved state.

d:\Temp\ff_stickers.js
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_141952.bak

These files are not replaced when you save the original, and there are remain as many of them as you save the origanal file.

d:\Temp\ff_stickers.js
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_141952.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142717.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142718.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142719.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142720.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142721.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142722.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142723.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142732.bak

And last option Directory, allows you to save *.bak files to a directory of your choice(here you can specify an arbitrary path).

d:\Temp\ff_stickers.js
d:\taravasya\BackUps\NPpp\ff_stickers.js.2022-04-19_143305.bak

Hope it help to use this great app and will save someone a lot of time and nerves))

  • 1
    we don't need all this junk - we want a simple autosave that saves every minute - some word processors have it since ages ago - no plugins and junk - we don't need all these fancy features - just a u t o save built in!! – gpasch Aug 29 '22 at 19:10
  • And how "just autosave" help when: **After an unplanned system restart, all of my Notepad++ temp (and unsaved) tabs are gone.**? (its what about topic starter ask) Personally, I'm not at all interested in automatically saving the original file. But the complete preservation of the workspace, all open and edited files, as well as their state at the time of the sudden shutdown - this is exactly what I need. And this is exactly what almost all modern text editors specializing in programming do now. And for this it is enough to enable both options in **Session snapshot and periodic backup**. – taravasya_github Aug 30 '22 at 14:05
0

Update November 2020

Autosave as it should be works on Notepad 32 bit V7.9.1

Before Nov. 2020

The autosave without a backup copy (just save after a time interval or by loosing the focus on the file) seems DEAD as of 2020.

Timo
  • 2,922
  • 3
  • 29
  • 28
  • The [github link](https://github.com/francostellari/NppPlugins) says "Releases | No releases published". Does that mean I have to compile myself if I want to use this plugin? – Henke Jan 17 '21 at 13:58
0

AutoSave In Notepad++

You can enable the AutoSave function in Notepad++ using the below Steps:

  1. Open Notepad++
  2. Open Plugins on Top/ Plugins Admin.
  3. Now Search for AutoSave from the options and Select it
  4. Click on Install, Notepad++ will get restarted

i.e, you can find that plugin under the plugin area on the top.

NB: Just go to the Autosave plugin and enable the time what you want in "Options".

That's it ! COMPLETED