Search code examples
terminalzshkeymapping

Remap ctrl+c to cmd+c


By default zsh suggest ctrl+c as interruption hotkey. I need to remap to cmd+c. I tried to do it via bindkey, but can't find interrupt-action id. What can I do with that? Thank you much.


Solution

  • This is not a problem of zsh itself - it's actually a setting of underlying terminal emulator. You can view your current terminal settings using stty -a command. Output of this command will most probably contain intr = ^C somewhere, which is the currently used control character for interrupt.

    Yes, you read it right - it is in fact a single character.

    That's where the main problem lies with your proposed new key combination - key combination Command + C (sometimes called Super + C) produce unmodified c character - there is no way for terminal to actually recognize if the Command key was pressed or not.

    So I'm afraid you can't changed it, at least not on shell level.