9

In zsh when I try and press CTRL-C nothing happens (it works fine in bash) when I run bindkey | grep \\^C I get "^C" Applications so something must've happened... how do I bind ^-C to the default?

4 Answers4

13

stty sane is usually a good starting place; outside of the zsh command line editor, it's a function of the terminal driver.

geekosaur
  • 12,091
3

Maybe another issue is the shell trap is set to something else. ( see Ctrl-C not working on MacOS/Zsh )

trap INT

resets this and fixed the problem for me.

thilo
  • 211
2

In my case, something had changed the zsh interrupt key (intr) to Control-G. To fix it:

stty intr ^C

(stty sane did not work.)

More detail:

% stty -a | grep intr
    eol2 = <undef>; erase = ^?; intr = ^G; kill = ^U; lnext = ^V;
% # Control-C did not work. So I used Control-Z to stop the ping:
% ping 1.2.3.4
PING 1.2.3.4 (1.2.3.4): 56 data bytes
Request timeout for icmp_seq 0
^CRequest timeout for icmp_seq 1
^CRequest timeout for icmp_seq 2
^Z
zsh: suspended  ping 1.2.3.4
% stty intr ^C
% stty -a | grep intr
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
# Control-C is working again.  Yes!
% ping 1.2.3.4
PING 1.2.3.4 (1.2.3.4): 56 data bytes
Request timeout for icmp_seq 0
^C
--- 1.2.3.4 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
nmgeek
  • 121
0

I just solved this situation by typing in the simple command ls after pressing ctrl-c, ctrl-c.

I think I was in some kind of multi-line input mode.

tjb
  • 189