Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
vim

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?

share|improve this question
    
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
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
add comment

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' > ~/.zshenv

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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