17

enter image description here

NERDTree goes whack in tmux session as in the picture. The same problem exists when windows are split. But now i am using powerline This time the Vim status goes whack(in the picture see the middle portion of the status line) in tmux. What is wrong?

Vysakh Sreenivasan
  • 1,719
  • 1
  • 16
  • 27
  • *Powerline* is wrong. Did you try its issue tracker? – romainl May 04 '13 at 13:13
  • Issue tracker of? You are saying powerline issue is a different one? I thought the wacky behavior is inter-related.Every time i split the screen and switch to a particular screen, lines overlap and is a mess. Happens only in tmux session. I don't think it is a powerline issue. – Vysakh Sreenivasan May 04 '13 at 13:16
  • 4
    What is your `$TERM` inside and outside of tmux? – romainl May 04 '13 at 13:49
  • @romainl Powerline is not wrong. Try setting statusline to a number of `a`'s that is greater then your screen width (`let &stl=repeat('a', &columns*2)`). You will see statusline starting with ` – ZyX May 05 '13 at 19:19
  • @romainl I.e. if powerline exceeded available width you would just see truncated statusline. But if *vim* thinks that available vertical space is wider then it actually is you will see the above picture. Powerline takes width from vim as well. – ZyX May 05 '13 at 19:22
  • Another possible source of trouble is vim thinking that some characters take less display cells then they actually take (possible e.g. if `&ambiwidth` setting in vim and similar setting in terminal emulator are `single` and (equivalent of) `double` respectively). But that is not the case here: with double ambiwidth in terminal emulator you would see gaps between powerline hard dividers (filled arrows) and one of the adjacent segments on one side. – ZyX May 05 '13 at 19:29
  • Checking `$ echo $COLUMNS` in and out of tmux and `:echo &columns` in Vim could be useful. – romainl May 05 '13 at 19:36
  • If I read correctly there are two tmux panes on screenshot (there are two active vim windows which should not be possible). As the same bad thing does not happen for tmux statusline below you are likely really having problems with determining width of powerline characters from private use area (arrows, branch symbol, `LN`). But I can’t say what is the problem and who is responsible: all problems of this kind I encountered always resulted in *all* powerline characters (not) working in the identical manner, never part of the characters near the middle. – ZyX May 05 '13 at 19:42

1 Answers1

26

I figured the solution after a long time, looking at a dotfile repo in github. It was just a single line of code that made the communication between Vim and Tmux smooth.

In the .tmux.conf file, add this line

set-window-option -g utf8 on
Vysakh Sreenivasan
  • 1,719
  • 1
  • 16
  • 27
  • 1
    Thanks. Mine was working perfectly until it starting behaving similarly one day. This fixed the issue. The Powerline fonts are not appearing correctly though but at least Vim is behaving sane again. – russoue Nov 03 '14 at 22:47
  • Great :) To fix the powerline fonts, you need to install few libs depending on your OS, may be this would help https://github.com/Lokaltog/powerline-fonts – Vysakh Sreenivasan Nov 04 '14 at 15:05
  • This is a testament to vim's longevity. A 3+ year solution still works. This solution didn't work for me until after I restarted my terminal. – Isaac Pak Jan 04 '17 at 17:17
  • 1
    No longer works. I get 'invalid option utf8' when I source after changing the conf. – michaelAdam Nov 02 '21 at 04:26