Is there a way to start VS Code keybinding with a comma?

51 views Asked by At

Is there a way to make a key-binding in VS Code that starts with , or ; as it is in vim?

Currently I have it in settings.json like this:

  "vim.leader": ",",
  "vim.normalModeKeyBindingsNonRecursive": [
        { "before": [ "<leader>", "n" ],          "commands": [ ":nohl" ] },
  ],

It works there. But I'd like to have all my keybindings in keybindings.json.

1

There are 1 answers

1
starball On BEST ANSWER

... yes?

{
    // chord (press comma, release, press n)
    "key": ", n", // or "[Comma] n"
    "command": "cursorUp"
},
{
    // (press comma, press n, release)
    "key": ",+n", // or "[Comma]+n"
    "command": "cursorUp"
}

But if you use the chord method, you'd need to create some other binding to insert a comma... VS Code doesn't have a thing to make chords time out and then fallback to inserting whatever incomplete parts of the chord were pressed.