Add this to your ~/.vimrc
:
silent !stty -ixon
If that creates problems with a non-tty vim
like gvim
(no idea, not able to test it), try this:
silent !test -t 0 && stty -ixon
It looks like they decided to make -ixon
the default in recent versions of vim, so this is soon going to stop being an issue with vim (notice that the original patch from the originator of the issue was untested garbage, but the final patch got it right).
Generally (with other programs), there's no general solution ;-)
xterm has a ttyModes
resource (and -tm
option) which can be used to set the initial modes, but which does not support -ixon
. I don't think that kitty
has even that.
Running stty -ixon
from inside vim doesn't work
That's because vim
restores the initial (usually non-raw) state of the terminal before running external commands via :!command
, and then changes it back to raw mode upon replying to the "Press ENTER or type command" prompt, so any changes performed by command
are lost.
As an extra note, the common folklore spread on this site & elsewhere (that ^S
/^Q
are just an anachronistic carryover from the time before less
and tmux
, etc) is wrong; software flow control is something you must use on any serial line without RTS/CTS out-of-band signaling (especially on a line with high baud rate), and something that is totally useless on any kind of virtual tty.
See this for the kind of problems that just blindly turning IXON
off (in that case by the ssh client on the local tty) may cause for people using actual serial lines to connect to their devices. Most programs which call cfmakeraw
(or duplicate it exactly) are bound to fail in the same way (script(1)
is the first one that comes to mind).
stty stop undef
. I don't know if this will persist in more situations.