Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rebind keyboard shortcuts in VS Code's terminal?

I'm running VS Code on macOS and would like to swap the Ctrl and keys, but only in the integrated terminal. Is there a way I can do this?

Context: I'm an ex-Windows user now running macOS, and all my muscle memory is based around Ctrl. As such, I've swapped Ctrl and in my macOS keyboard settings, which allows me to e.g. copy text as I'd expect using Ctrl+C.

Unfortunately it seems that terminal applications on Mac do actually use the real Ctrl key, e.g. using Ctrl+C to send SIGINT. My global key-swap now makes that +C, which is icky.

iTerm allows me to swap Ctrl and back again, and I'd like to do the same in VS Code - but only in its integrated terminal.

like image 710
Floomi Avatar asked Oct 27 '25 14:10

Floomi


1 Answers

So far my best option has been to rebind individual keystrokes in keybindings.json:

{
    "key": "cmd+c",
    "command": "workbench.action.terminal.sendSequence",
    "args": {
        "text": "\u0003"
    },
    "when": "terminalFocus && !terminalTextSelected"
}

This works, and the set of control characters I'd have to get through is smaller (I'd guess Ctrl + C, Z, D). But this is still not ideal.

like image 147
Floomi Avatar answered Oct 30 '25 07:10

Floomi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!