64

I'd like the option to have Notepad++ exit, and close individual tabs without asking me if I want to save every file where edited.

I tend to run with a lot of tabs open, and am capable of remembering to save when I need to. Being asked to save when closing multiple is annoying, and a little dangerous in that if the modal dialogue box moves on each tab, there is a chance of accidentally hitting yes when I didn't mean to.

Update 07/2020

In a recent version of Notepad++ there is a 'No to all' option when closing Notepad++ down. This has mitigated the issue somewhat, although I would still like to see a setting that just allowed me to close everything without saving along with the main window.

2
  • 2
    There is a feature request for this, please support it: notepad-plus-plus.org/community/topic/11784/…
    – Joe
    Commented Jan 10, 2018 at 7:15
  • I downvoted this question for low quality because after providing the answer, it turned out that there are further requirements not mentioned in the text of the question. The correct approach would be early correction of the question or keeping original requirements (so Q and A go nice together) and post another question with detailed description of special requirements of the author different from the original question.
    – miroxlav
    Commented Jul 25, 2018 at 16:39

4 Answers 4

89

Yes, there is. In Backup page of Preferences, be sure you check

  • Remember current session for next launch

  • Enable session snapshot and periodic backup

enter image description here

▶ Then Notepad++ exits immediately without asking.

Open documents are retained, but it is as easy as pressing Ctrl+W to close them. You can also assign some shortcut to Close All command (suggestion: Ctrl+Shift+W).


EDIT: You can close individual tabs if they have no name yet without warning (but keeping Notepad++ open) when you press Ctrl+A and then Delete right before closing the tab. You can even try to create a macro for that. If not Notepad++ macro, then AutoHotKey macro will easily do it.

Note that there is no way to do this for unsaved documents which already have the name. I checked the source code. So after closing unnamed documents you can get rid of the rest by using Save All command and then closing any remaining documents you want.

If your tabs are mixed (new, exsting, new, existing, ...), it is better to create AutoHotKey macro which invokes closing and then presses No button in case if the save dialog appears. This will close current tab without saving regardless of its new or existing state.

There is yet another option how to avoid the question on closing a tab: you can download source code of Notepad++, modify it (so the dialog is never shown), build it and start using your own Notepad++ build.

You can also request the feature at N++ home page, but here is the risk that it could be viewed as rare corner-case and you might be waiting very long until someone implements it (if ever).

8
  • 2
    This doesn't work I'm afraid. While it allows Notepad++ to exit entirely with out a save prompt, it does not work for closing individual tabs. If you close a tab and the document has been edited, it still prompts and asks if I want to save the file.
    – gbro3n
    Commented Aug 8, 2015 at 18:25
  • 1
    @gb2d – Sure, but in title you said Is there a setting to stop from asking me to save on exit? and this is what the answer shows. You then continue I'd like the option to have Notepad++ exit, and close individual tabs without asking me if I want to save every file where edited. My answer describes exactly this functionality. :) Perhaps you meant closing individual tabs without asking, keep N++ open but that is completely different question from what you wrote... What now? It is not allowed to change question merit, but you can always post a new question clearly specifying what you need.
    – miroxlav
    Commented Aug 8, 2015 at 18:43
  • OK, I've extended the answer to reflect the requirement you described in the comment.
    – miroxlav
    Commented Aug 8, 2015 at 19:16
  • Ctrl + A, then delete - so select all text, delete it and then close? That still prompts to save if deleting the text results in the file changing from it's original state. Your suggestion of customising the source may be the way to go here however. I will look into that.
    – gbro3n
    Commented Aug 9, 2015 at 7:57
  • See the updated answer. Close unnamed tabs first, then Save all and continue closing named tabs. I checked against the Notepad++ source code to confirm under what conditions save dialog is displayed. All possible ways are now covered by the answer so you can accept it as reliable one.
    – miroxlav
    Commented Aug 9, 2015 at 8:36
6

I just had this problem when I had demonstrated to a colleague how to find/replace on 150 files in a folder I didn't have write access to. My solution is a bit of a hack, but it works. I went into C:\users\[username]\AppData\Roaming\Notepad++\backup and deleted all the files in there. Then I force-quit Notepad++ with the task manager and open it back up. It still has the files I had open but now they show as unchanged, so I can hit Close All and they close without dialogs.

An alternate option appears to change the session.xml file in there and just take out all the files you had open.

1
  • @gb2d – this is a clever answer. Perhaps something acceptable for you?
    – miroxlav
    Commented Jun 2, 2017 at 10:37
1

I tend to open a new tab on each meeting/call to take notes, and then leave it. I would usually like the notes to be available for 2-3weeks (But not forever). Cleaning up the hundreds of tabs is always a pain. But I have found the best way to be.

As you in current version can rightclick on a tab and select to close all tabs to right/left of it, simply start from the begining, check 10-30tabs then take close all to left, on the popup regarding saving you say "no to all". Then repeat, repeat, repeat

0

go to %UserProfile%\AppData\Roaming\Notepad++\plugins\config\SessionMgr

Edit the settings.xml file and change

<automaticSave value="0"/> to <automaticSave value="1"/>

That will stop you been prompted to save each file. Note this setting controls the saving of the session, not the files, so it will save a xml for the session.

if you also change :

<automaticLoad value="1"/> to `<automaticLoad value="0"/>`

I believe that you should get a fresh session each time you load notepad++, when you close notepad++ it overrides your last saved session. To the user it should do what you want, and the saving of the session can be a back stop for the rare case you exit by error.

2
  • @DarkDiamond thanks for the suggestion, I included the location because it is not common knowledge how to get the to settings.xml. If a someone does not have hidden folders showing, to find the AppData directory can be difficult. Advance users will just ignore the location. Commented Dec 17, 2022 at 0:07
  • I don't have the folder SessionMgr (and so do not have the settings.xml file either). It's a relatively new install of Notepad++. Do I need a plugin installed for this?
    – gbro3n
    Commented Dec 17, 2022 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .