If you're familiar with Python, you could try the Python Script plug-in for N++. You would set up a callback script for the document-closed-event. Inside it do some iteration through all opened docs, and when there's only 1 left with no text in it, then terminate N++.
Personally I mapped the keys "Alt + x" to "Exit" Notepad++, which is easier to grap then the usually working "Alt + F4".
/EDIT
I actually quite liked your idea, so I've quickly tried it myself. It took ~20 minutes to figure it out. Here's a complete solution:
- Install the plug-in Python Script (link above)
- Go to Plugins > Python > Configuration and change Initialisation mode from LAZY to ATSARTUP
- Open up "...\Notepad++\plugins\PythonScript\scripts\startup.py" and place following code at the end of it: Seems like the code tags don't work below a numbered list, so click me to see the code
def shutdownNppOnLastFileClosed(args): import os files = notepad.getFiles() # there are always at least 2 'buffers' open in N++ if len(files) == 2: currentBufferID = notepad.getCurrentBufferID() for (filename, bufferID, index, view) in files: if os.path.exists(filename): break notepad.activateBufferID(bufferID) if editor.getLength() > 0: break # TODO: just to be on the safe side - if we # reached here, we actually should also check # if the 2 left empty buffers are not unsaved, # but I couldn't find a way to do that. else: # following 'menuCommand' looks cleaner than # the 'sys.exit' but it currently deadlocks N++: #notepad.menuCommand(MENUCOMMAND.FILE_EXIT) sys.exit(0) notepad.activateBufferID(currentBufferID) notepad.callback(shutdownNppOnLastFileClosed, [NOTIFICATION.FILECLOSED])