1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 11:35:35 +03:00

Close the “Discard and Quit” menu with ⌘-D

Allow quitting the application with an unsaved 
buffer via the keyboard. macvim makes the “Quit” 
button default. vimr makes the “Cancel” button 
default, leaving no way to “Discard and Quit” 
without using the mouse (as far as I can tell). 

⌘-D uses the convention of ⌘ + first letter of 
the button text
This commit is contained in:
Neal Clark 2017-10-05 17:18:47 -07:00
parent 746676a918
commit 911e860d36

View File

@ -137,9 +137,11 @@ extension AppDelegate {
if self.hasDirtyWindows && self.hasMainWindows {
let alert = NSAlert()
alert.addButton(withTitle: "Cancel")
alert.addButton(withTitle: "Discard and Quit")
let discardAndQuitButton = alert.addButton(withTitle: "Discard and Quit")
alert.messageText = "There are windows with unsaved buffers!"
alert.alertStyle = .warning
discardAndQuitButton.keyEquivalentModifierMask = NSCommandKeyMask
discardAndQuitButton.keyEquivalent = "d"
if alert.runModal() == NSAlertSecondButtonReturn {
self.uiRoot.prepareQuit()