Si está familiarizado con Python, puede probar el plug-in Python Script para N ++. Debería configurar un script de devolución de llamada para el documento cerrado-evento. Dentro, haga una iteración a través de todos los documentos abiertos, y cuando solo quede 1 sin texto, termine N ++.
Personalmente asigné las teclas "Alt + x" a "Salir" del Notepad ++, que es más fácil de graficar que el "Alt + F4" que normalmente funciona.
/EDIT
De hecho, me gustó bastante su idea, tan rápido que he probado a mí mismo. Tardó ~ 20 minutos en descubrirlo. Aquí hay una solución completa:
- Instalar el plug-in de secuencias de comandos de Python (enlace de arriba)
- Ir a Plugins> Python> Configuración y cambiar inicialización modo de LAZY a ATSARTUP
- Abra "... \ Notepad ++ \ plugins \ Pyth OnScript \ scripts \ startup.py "y colocar siguiente código al final de la misma: 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])
tiene un error - cuando no hay documentos guardados abiertos - se abrió solo (un && vacío && no modificado) documento - no es trabajo – msangel