Vim goes whack with tmux
Asked Answered
P

1

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?

Photomontage answered 4/5, 2013 at 12:51 Comment(8)
Powerline is wrong. Did you try its issue tracker?Reprint
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.Photomontage
What is your $TERM inside and outside of tmux?Reprint
@Reprint 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 <aaaaa and ending with aaa. Not statusline on two lines like shown above.Ursulaursulette
@Reprint 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.Ursulaursulette
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.Ursulaursulette
Checking $ echo $COLUMNS in and out of tmux and :echo &columns in Vim could be useful.Reprint
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.Ursulaursulette
P
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
Photomontage answered 5/8, 2013 at 11:7 Comment(4)
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.Atone
Great :) To fix the powerline fonts, you need to install few libs depending on your OS, may be this would help github.com/Lokaltog/powerline-fontsPhotomontage
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.Manolete
No longer works. I get 'invalid option utf8' when I source after changing the conf.Hypodermis

© 2022 - 2024 — McMap. All rights reserved.