15

This only seems to happens when using vim inside of tmux. I'm also using iTerm 2.

If I create a new tmux pane or resize a tmux pane, it immediately looks like the this:

messed up background in vim

And then the only way to fix it is to scroll around in vim, and it goes back to this:

good background in vim

What could be causing this?

19

You might try to add the following to your .vimrc.

if &term =~ '256color'
  " disable Background Color Erase (BCE)
  set t_ut=
endif

The t_ut option (default = y) describes how vim handles what it wants as background colors compared to attempting to use the current background color. This snippet clears that option.

If not, then you might try to

set ttyfast

which is an option that handles how vim redraws screens.

  • 2
    Setting the t_ut option worked! – aharris88 Feb 4 '15 at 6:04
  • This didn't work for me. I've already set ttyfast, and tried clearing t_ut with no effect. My setup is the same as the OP, with the exception that I'm using termguicolors inside a Tmux configured for true color support. Vim draws splendidly inside iTerm, but starts showing the same screen weirdness as above when I run inside Tmux. Let me know if I should open a new question; I thought I would reach out here since I'm experiencing essentially the same problem. – djmoch Jun 6 '16 at 10:17
1

I believe this is related to ttyfast so the screen is not fully redrawn. Try setting it to on:

'ttyfast' 'tf'      boolean (default off, on when 'term' is xterm, hpterm,
                    sun-cmd, screen, rxvt, dtterm or
                    iris-ansi; also on when running Vim in
                    a DOS console)
            global
            {not in Vi}
    Indicates a fast terminal connection.  More characters will be sent to
    the screen for redrawing, instead of using insert/delete line
    commands.  Improves smoothness of redrawing when there are multiple
    windows and the terminal does not support a scrolling region.
    Also enables the extra writing of characters at the end of each screen
    line for lines that wrap.  This helps when using copy/paste with the
    mouse in an xterm and other terminals.

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.