0

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.

MegaBomber
  • 345
  • 2
  • 3
  • 11
  • 1
    You almost certainly do not *need* to remap it. But why would you *want* to, either? The command key was specifically added to provide OS- and application-level keyboard shortcuts that wouldn't interfere with key combinations already used by other programs. – chepner Oct 10 '21 at 17:32

2 Answers2

1

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.

rcwnd_cz
  • 909
  • 6
  • 18
0

This will make you keyboard works like Mac.

Remaps Left Ctrl with AltGr

sudo vi /usr/share/X11/xkb/symbols/ctrl

Change the section

// Map Ctrl to the left Alt key, Alt to the left Win key, // and Super to the left Ctrl key.

when it says "replace key " with

replace key { [ ISO_Level3_Shift ] };

Open Tweaks On Additional Layout Options -> Ctrl , mark "Map Ctrl to the left Alt key, Alt to the left Win key, and Super to the left Ctrl key."

On your shell configuration .zshrc in my case, remap to intr check if you have the cent symbol there before. Add this to the file :

stty intr 0xA2

On gnome-terminal remap the copy and paste shortcuts to "Ctrl C" "Ctrl V"

And move physically your keys to make sense