As far as my setup is concerned, I'm running Tmux 2.2 (with true color support enabled) inside iTerm2 version 3 on a Mac. To clarify, there are other questions already answered which address essentially the same problem I am experiencing, but none of the offered solutions (ttyfast
or set t_ut=
) fix the issue for me unless I turn termguicolors
off.
Here's what I see when I run Vim in iTerm2 directly. Everything looks as I expect:
But I end up with strange background issues when I run inside Tmux:
Now the colors are pretty close, so it might be hard to see, but it's actually very jarring when I'm running full screen with split panes and lots of text.
To my eye it looks like the text background color is rendering correctly, and the background color for blank lines renders correctly, but for some reason the background color past the end of the text renders incorrectly. This is probably consistent with other similar questions I've seen.
Here's a picture showing what I mean. Blank lines also render the background color correctly:
As a final data point, I ran set termcap
to dump the terminal settings and verified that everything matches between when I run Vim in iTerm vs when I run in Tmux.
Some additional details brought out from the comments below:
- The theme always works in Neovim (v0.1.4), whether I run in Tmux or in iTerm directly. This leads me to believe it is not an issue with the theme, or with Tmux.
- The terminal in Tmux is set to
screen-256-color
. Because of limitations in the way Vim handlestermguicolors
, this means I end up having to manually sett_8f
andt_8b
values.
If anyone has any suggestions on what I can try to fix this issue, I'm all ears.
echo $TERM
(and also, what does:set term?
in Vim output)?termguicolors
to work at all inside Tmux without manually settingt_8f
andt_8b
, I addedset-option -g default-terminal "xterm-256color"
to my.tmux.conf
. So the short answer to your question is that bothecho $TERM
and:set term?
returnxterm-256color
.TERM
insidetmux
should bescreen*
, notxterm*
.screen-256color
and sett_8f
andt_8b
, but the result is the same.