Rei Jarram
Rei Jarram

Reputation: 1004

How to disable VS Code chords

I'm using VS Code 1.51.11 on Mac OS X.

Inside my integrated terminal I want to use the binding CMD+K to trigger the clear command to clear the terminal. It works in my regular Terminal.app, but when I do it in VS Code's integrated terminal I receive the message CMD+K was pressed. Waiting for second key of chord....

I've done research on how to disable chords in VS Code but found no solution in the official documentation or other blog posts on the internet.

I've also checked my key bindings and CMD+K is mapped to this key binding:

  {
    "key": "cmd+k",
    "command": "-workbench.action.terminal.clear",
    "when": "terminalFocus && terminalProcessSupported"
  }

Any help in helping me to actually map CMD + K to the desired functionality (clearing the integrated terminal in VS Code) would be awesome!

Upvotes: 9

Views: 4521

Answers (2)

davidkuda
davidkuda

Reputation: 301

If you follow Mark's instructions but cmd + k still doesn't work, you might have this problem:

I had assigned the shortcut editor.unfold to cmd + k cmd + u. This prevented cmd + k to clear the terminal. I had to add a when clause to the shortcut: editorTextFocus && foldingEnabled.

First, follow Mark's instructions. If it still doesn't work, this might be it:

This doesn't work

In my VSC this setting has prevented cmd + k to clear the terminal:

{
    "key": "cmd+k cmd+u",
    "command": "editor.unfold"
}

This works

After adding the when clause editorTextFocus && foldingEnabled, I could again use cmd + k in the terminal.

{
    "key": "cmd+k cmd+u",
    "command": "editor.unfold",
    "when": "editorTextFocus && foldingEnabled"
}

Upvotes: 1

Mark
Mark

Reputation: 181784

There are two things for you to do. As reported elsewhere disable this setting (enabled is the default):

Terminal > Integrated : Allow Chords

Also, your keybinding

{
  "key": "cmd+k",
  "command": "-workbench.action.terminal.clear",
  "when": "terminalFocus && terminalProcessSupported"
}

has a - before the command. That serves to remove that keybinding and so regardless of the Allow Chords settings, that keybinding would never work. Remove the - to enable the keybinding.

Upvotes: 9

Related Questions