55

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 its session automatically?

3
  • 1
    see this answer for an alternate solution: stackoverflow.com/questions/24081157/… Commented Dec 14, 2014 at 15:02
  • I'ts not clear, ypour question is abut saving session (list of open files) or files? Commented Feb 26, 2019 at 5: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? Commented Jul 20, 2019 at 22:56

6 Answers 6

44

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.

Sign up to request clarification or add additional context in comments.

7 Comments

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).
If you're having problems getting this plugin installed... superuser.com/questions/292340/…
@mauro_oto, at least from v1.20 ( 2010-07-16) Franco Stellaris Autosave plugin now handles autosave on loss of focus.
To be noted: it's v1.6 on the dev site already (updated in 2017-02-08)
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.
|
26

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

3 Comments

Very interesting. Only a few files in there, with names e.g. example.txt@2016-09-30_113259 When does something go in there?
I'm having the same thing, seems a bit random what gets stored (mostly nothing). Autosave2 plugin mentioned above works better for me.
This doesn't actually force the current file to be save to its original location.
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.

2 Comments

I installed the plugin but I am unable to figure out the location , it saves the file at . Can you brief that ?
A direct link to the second one: scout-soft.com/autosave/index.html Like devs say, it's more autocopy than autosave
8

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

3 Comments

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!!
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.
I think it is a great feature if you work on live files to not put periodically unfinished edit in the file;s if you work on copy from a repo this feature is less useful a traditional autosave is as good.
2

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

Comments

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.

1 Comment

The github link says "Releases | No releases published". Does that mean I have to compile myself if I want to use this plugin?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.