47

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.

  • There is a feature request for this, please support it: notepad-plus-plus.org/community/topic/11784/… – Joe Jan 10 '18 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 Jul 25 '18 at 16:39
72

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

  • 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. – gb2d Aug 8 '15 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 Aug 8 '15 at 18:43
  • OK, I've extended the answer to reflect the requirement you described in the comment. – miroxlav Aug 8 '15 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. – gb2d Aug 9 '15 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 Aug 9 '15 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.

  • @gb2d – this is a clever answer. Perhaps something acceptable for you? – miroxlav Jun 2 '17 at 10:37

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.