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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With