Nếu bạn đã quen thuộc với Python, bạn có thể thử trình cắm thêm Python Script cho N ++. Bạn sẽ thiết lập tập lệnh gọi lại cho sự kiện đóng tài liệu. Bên trong nó làm một số lần lặp lại thông qua tất cả các tài liệu đã mở và khi chỉ còn lại 1 văn bản không có văn bản, hãy chấm dứt N ++.
Cá nhân tôi đã ánh xạ các phím "Alt + x" để "Thoát" Notepad ++, điều này sẽ dễ dàng hơn để làm hỏng sau đó thường làm việc "Alt + F4".
/EDIT
Tôi thực sự rất thích ý tưởng của bạn, vì vậy tôi đã nhanh chóng thử nó bản thân mình. Mất ~ 20 phút để tìm ra. Dưới đây là một giải pháp hoàn chỉnh:
- Cài đặt plug-in Python Script (link ở trên)
- Đến Plugins> Python> Cấu hình và thay đổi initialisation chế độ từ LAZY để ATSARTUP
- Mở "... \ Notepad ++ \ plugins \ Pyth onScript \ scripts \ startup.py "và địa điểm sau mã ở phần cuối của nó: 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])
có lỗi - khi không có tài liệu nào được mở - chỉ mở (một && trống && không thay đổi) tài liệu - nó không hoạt động – msangel