Sublime Forum

Wanring before quit


Hi, Sublime have option like Google Chrome while using Command + Q?
I usually using Command + W to close current tab, sometime i hit wrong to Command + Q and Sublime quit :frowning:



I’m not aware of any internal option to make Sublime do this; generally with hot_exit on the application state would be saved and restored and it usually starts pretty fast.

You can add this functionality with a simple plugin and key binding, though. If you’re not sure how to use plugins, see this video.

import sublime
import sublime_plugin

class ConfirmQuitCommand(sublime_plugin.ApplicationCommand):
    def run(self):
        if sublime.yes_no_cancel_dialog("Are you sure you want to Quit?") == sublime.DIALOG_YES:

Once the plugin is in place, you can add a key binding that overrides the default to run this new command instead of the internal one.

    { "keys": ["super+q"], "command": "confirm_quit" },


Thank you. It worked :slight_smile: