18

Occasionally I get a weird error with the background color in vim when scrolling up in a long file. The background over the text is correct, but everywhere there is no printable character the background turns black.

After a bit of hunting and experimenting, I have found that :redraw! fixes the problem, but I would like to know why this occurs and if there is anything I can do to permanently fix the issue.

Although I have gotten this error to occur with other color schemes, for what it is worth I am using the lucius color scheme with vim 7.3 editing a bunch of python files.

5
  • I've done a bit more playing, and it seems to happen only when I have my terminal geometry set with a height larger than 30 or so. I'll have to do more testing to see if this holds, but maybe that information will help someone figure out what is wrong...
    – jlund3
    Aug 6, 2012 at 0:58
  • Here is an example screenshot of this behavior. I scrolled up and instead of the lovely grayish background, there is some ugly black stuff. screenshot
    – jlund3
    Aug 6, 2012 at 1:22
  • Have you tried several different terminal emulators (like xterm, gnome-terminal, etc.)?
    – amcnabb
    Aug 7, 2012 at 20:48
  • I've managed to reproduce the behavior in both lxterminal and gnome-terminal.
    – jlund3
    Aug 7, 2012 at 21:18
  • I have the exact same problem. Mine started to happen when i moved stuff to ftplugin/<filetype>...
    – RedX
    Mar 15, 2013 at 13:48

2 Answers 2

29

As explained here and here, you can fix this by turning off Background Color Erase. Change in your .vimrc:

if &term =~ '256color'
    " Disable Background Color Erase (BCE) so that color schemes
    " work properly when Vim is used inside tmux and GNU screen.
    set t_ut=
endif

You can also type Ctrl+L to reset the screen.

0

This may be a plugin or configuration related, perhaps try

vim -u NONE

to load vim without the vimrc and without plugins and see if the problem persists.

As far as configuration, I think you should probably look at lazyredraw and ttyfast.

You can read the documetation by typing (:help lazyredraw) and find out if you've unknowingly set it (:set lazyredraw?) and probably unset it (:set nolazyredraw).

And it may help if you set ttyfast (:help ttyfast).

3
  • I tried both nolazyredraw and ttyfast, but the behavior remains the same.
    – jlund3
    Aug 6, 2012 at 0:54
  • @jlund3 I've edited my answer a little bit.
    – carlosdc
    Aug 6, 2012 at 1:55
  • With -u NONE there are no colors for this to happen. However, with just the command :colorscheme lucius it still happens...
    – jlund3
    Aug 6, 2012 at 2:46

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.