In my shell I have flow control disabled using stty -ixon. This works perfectly in the shell and when I launch tmux and start programs within tmux.

However, when starting a new session from the command line and directly launching a command, the flow control setting is not respected and ctrl-s freezes the terminal.

This works:

tmux new-session -s foo

This does not respect the stty flow control setting:

tmux new-session -s foo vim

How can I disable flow control even in the latter case?

  • Is it sufficient to disable flow control all together within tmux for all cases, or are you interested in nailing down why it works in the first example but not the second? – slm May 14 '13 at 0:12
  • @slm In the first place I'd like to have it fixed. Nevertheless, I'm interested why tmux behaves as it does. – Marco May 14 '13 at 6:51

If you have stty -ixon in your shell's initialization, it's rather simple: when tmux creates new terminals, it runs user's default shell by default and that in turn disables the control flow during the initialization. However, when you ask tmux to run a specific command (ViM in your case), no initialization takes place and the default terminal settings (flow control enabled) apply.

tmux new-session -s foo "stty -ixon; vim"

should fix your problem.


A workaround which does not require changing the tmux call is to include the stty call in the file $HOME/.zshenv. This file is parsed by ZSH and used even for non-interactive shells.

echo 'stty -ixon' | tee -a ~/.zshenv
# ... or ...
echo 'stty -ixon' >> ~/.zshenv

BASH users have to set the environment variable BASH_ENV=$HOME/.zshenv to make this work.

  • 2
    I don't know what it does, but it did the trick. Added it to both .zshrc and .zshenv. Be careful with > though. Use: echo 'stty -ixon' >> ~/.zshenv – firedev Apr 12 '15 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.