4

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:

Vim in iTerm2

But I end up with strange background issues when I run inside Tmux:

enter image description here

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:

enter image description here

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 handles termguicolors, this means I end up having to manually set t_8f and t_8b values.

If anyone has any suggestions on what I can try to fix this issue, I'm all ears.

8
  • 1
    When you're in tmux, what's the output of echo $TERM (and also, what does :set term? in Vim output)?
    – muru
    Jun 7, 2016 at 10:10
  • In order to get termguicolors to work at all inside Tmux without manually setting t_8f and t_8b, I added set-option -g default-terminal "xterm-256color" to my .tmux.conf. So the short answer to your question is that both echo $TERM and :set term? return xterm-256color.
    – djmoch
    Jun 7, 2016 at 10:16
  • See unix.stackexchange.com/a/1098/70524, TERM inside tmux should be screen*, not xterm*.
    – muru
    Jun 7, 2016 at 10:18
  • I've changed to screen-256color and set t_8f and t_8b, but the result is the same.
    – djmoch
    Jun 7, 2016 at 10:23
  • Apprentice author, here. Please use the issue tracker.
    – romainl
    Jun 7, 2016 at 12:01

1 Answer 1

4

Turns out this was a bug in Vim itself. The problem is resolved as of Vim 7.4.1942.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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