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?
Asked
Active
Viewed 1.0k times
8
Dennis Williamson
- 106,229
- 19
- 167
- 187
errorhandler
- 195
- 1
- 1
- 6
-
What are you trying to do with Ctrl-c? What does `stty -a` show (with respect to `intr` and `^C` (in a freshly started zsh session)? – Dennis Williamson Mar 05 '11 at 01:30
-
1go to a new line in the shell, and `intr = ^C;` – errorhandler Mar 05 '11 at 02:09
4 Answers
10
stty sane is usually a good starting place; outside of the zsh command line editor, it's a function of the terminal driver.
geekosaur
- 11,723
- 32
- 40
1
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
- 111
- 2
1
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
- 31
- 2
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
- 179
- 10