Sublime Forum

"keys" is ignored for a custom command

#1

This is my Default.sublime-commands:

[
  {
    "caption": "Create Pull Request in GitHub...",
    "command": "git",
    "args": { "argv": ["pr"] }
  },
  {
    "keys": [ "super+[" ],
    "caption": "Checkout previous",
    "command": "git",
    "args": { "argv": ["co", "-"] }
  }
]

I can see the custom commands in the palette, but the keys for the second one are not assigned, what am I doing wrong?

0 Likes

#2

Key bindings must be defined in a keymap (Preferences > Key Bindings), they can’t be defined in a .sublime-commands.

1 Like

#3

thanks! I was able to make it work by copying the same JSON to the keybindings file (but without caption):

{
  "keys": ["super+["],
  "command": "git",
  "args": { "argv": ["co", "-"] }
}
0 Likes