christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.31k stars 328 forks source link

<C-s> does not work inside vim (freezes terminal) #215

Open kerneis opened 6 years ago

kerneis commented 6 years ago

I use a bépo layout (a French dvorak variant, http://bepo.fr), hence have a custom mapping using ctsr instead of hjkl. This works flawlessly following the instructions from the README, except for <C-s> inside vim. It should move to the pane upwards (either vim or tmux), but what happens instead is that it freezes the terminal, and I need to <C-q> to unfreeze it.

Note that <C-s> works to switch from tmux to vim or from tmux to tmux. My guess is that the vim plugin somehow "forwards" the <C-s> to the underlying terminal in the hope that it be caught by vim, by the terminal is catching it before and freezes.

Relevant config snippet from .vimrc:

nnoremap <silent> <C-s> :TmuxNavigateUp<cr> 
kerneis commented 6 years ago

It works in neovim though. I guess that's a reasonable work-around (and one more reason to switch).

christoomey commented 6 years ago

Hi @kerneis, I think this might be a terminal setting rather than anything the plugin is doing. Ctrl-s will by default freeze terminal input waiting for Ctlr-q (I think?), but you can disable this with stty -ixon in a relevant shell initi file, ~/.bashrc or ~/.zshrc or similar depending on your shell, (ref stack overflow post). Can you give that a shot and let me know if it solves the problem?

kerneis commented 6 years ago

I first thought it would be a terminal issue, but the fact that with the exact same terminal / shell / config etc. it works when inputting Ctrl-s in neovim or in a tmux pane directly, but freezes if it's a vim pane, makes me suspect something else is going on.

On the other hand, setting stty -ixon in ~/.bashrc indeed also works around the issue. I don't really at what level a shell is started that interprets this Ctrl-S, but either this or switching to neovim work for me, so I'm happy with the result.