Search code examples
sublimetext3key-bindings

Sublime Text 3 - Key Binding for Cancel Build isn't working (Windows)


I got the key binding for cancel build working before by using this setting:

"keys": ["ctrl+alt+c"], "command": "cancel_build",

But since a few days ago I couldn't use that key binding to cancel build. I searched for the fix and found out that the preferred key binding for cancel build (from this this post and this post on Sublime Text forum) is:

"keys": ["ctrl+alt+c"], "command": "exec", "args": {"kill": true},

I changed the setting to that, but still, it doesn't work (I've tried different key combinations) and I have to manually cancel build in Tools > Cancel Build.

Does anyone know how to fix this problem? Any help is appreciated!

Below is my current key binding settings (the first one is not working as described in this post, the second one is working just fine).

[
    {
        // "keys": ["ctrl+alt+c"], "command": "cancel_build",
        "keys": ["ctrl+alt+c"], "command": "exec", "args": {"kill": true},
        "keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args":
            {
                "id": "repl_python_run",
                "file": "config/Python/Main.sublime-menu"
            }
    }
]

Thanks.


Solution

  • Putting everything into one JSON object means the later keys override the earlier ones. So when deserializing your keybinding file, it only sees your binding on ctrl+alt+b.

    Instead, each keybinding should be in it's own dictionary:

    [
        {
            "keys": ["ctrl+alt+c"], "command": "exec", "args": {"kill": true},
        },
        {
            "keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args":
                {
                    "id": "repl_python_run",
                    "file": "config/Python/Main.sublime-menu"
                }
        }
    ]