Also, in many terminals Ctrl and numbers can be used to replace Ctrl with some punctuation:
^2 is the same as ^@
^3 is the same as ^[ (aka Esc)
^4 is the same as ^\
^5 is the same as ^]
^6 is the same as ^^
^7 is the same as ^_
Some of these kind of make sense when you squint at an ASCII table.
Edit: it seems that these go at least back to VT220 terminals except that ^6 and ^7 are different. I arrived at the list above by trying the keys out on iTerm2, but I’m sure I’ve used at least ^3 for Esc on several different computers.
We ran into an opposite problem with fish-shell: out-of-the-box, we used to set the terminal mode ourselves to allow ctrl+s to reach the shell and then ran into a subset of users who complained it broke flow control for them (because they were actually using the default ctrl+s xon/xoff behavior). We ended up detecting when the user explicitly re-enabled control flow (stty ixon) and flagging it internally to ensure that we didn’t override their preference.
In zsh you can also use setopt no_flow_control to disable ^S and ^Q. The difference with stty is that it only applies to ZLE (the zsh line editor) rather than everything, which may be better or worse, depending on what you want.
Also, in many terminals Ctrl and numbers can be used to replace Ctrl with some punctuation:
^2
is the same as^@
^3
is the same as^[
(aka Esc)^4
is the same as^\
^5
is the same as^]
^6
is the same as^^
^7
is the same as^_
Some of these kind of make sense when you squint at an ASCII table.
Edit: it seems that these go at least back to VT220 terminals except that ^6 and ^7 are different. I arrived at the list above by trying the keys out on iTerm2, but I’m sure I’ve used at least ^3 for Esc on several different computers.
We ran into an opposite problem with fish-shell: out-of-the-box, we used to set the terminal mode ourselves to allow ctrl+s to reach the shell and then ran into a subset of users who complained it broke flow control for them (because they were actually using the default ctrl+s xon/xoff behavior). We ended up detecting when the user explicitly re-enabled control flow (
stty ixon
) and flagging it internally to ensure that we didn’t override their preference.In zsh you can also use
setopt no_flow_control
to disable ^S and ^Q. The difference withstty
is that it only applies to ZLE (the zsh line editor) rather than everything, which may be better or worse, depending on what you want.