Search code examples
sublimetext3sublimetext

Sublime 3 returns "Unable to parse binding" when I add a key combination


I entered this into "Default (OSX).sublime-keymap":

[
    {
        "key": ["option+f1"],
        "command": "insert_snippet",
        "args": {"contents": "h2"}
    }   
]

And in the Console, Sublime 3 returned:

Unable to parse binding {args: {contents: h2}, command: insert_snippet, key: [option+f1]}

Of course, the key combination doesn't work. Any idea why?


Solution

  • The JSON key for specifying the key binding is keys and not key, even if there's only a single key in the list. Something like the following should do what you want:

        {
            "keys": ["option+f1"],
            "command": "insert_snippet",
            "args": {"contents": "h2"}
        },