Sublime Forum

Key binding context confusion (order matters)

#1

I have the following in my Default.sublime-keymap:

    { "keys": "/"], "command": "close_tag_on_slash", 
      "context": { "key": "setting.command_mode", "operator": "equal", "operand": false } },
    { "keys": "/"], "command": "show_panel", "args": {"panel": "find", "reverse": false},
        "context": {"key": "setting.command_mode"}]
    },

If I reverse the ordering (have close_tag_on_slash come after “show_panel”), then “/” no longer opens the find panel and instead inserts a “/” when I’m in command mode. I assume this is because I’ve got the context for “close_tag_on_slash” wrong? Any suggestions on how to have “close_tag_on_slash” trigger only when in Vintage insert mode other than rely on ordering? Clearly I don’t understand contexts yet. Thanks!

0 Likes

#2

In the first key binding, context needs to be an array, rather than an object - I’ll update the next build to print a warning on the console when this happens

0 Likes

#3

Oh duh, thanks!

0 Likes