You may know this problem if you are using vim inside of a screen or tmux terminal:
Assuming you are using your terminal with a dark background color (as many do), but need a light colorscheme (with a light background color) in vim, you may encounter a view like this.
The TERM environment variable
As you can see on this image, the vim background(white) ends when printable characters on a line end, after this point it will default back to the terminal emulators background.
This is due to a specific environment variable most people set when inside
A setting like this:
# In screenrc: term screen-256color-bce # In tmux.conf set -g default-terminal "screen-256color-bce" # Shell equivalent: export TERM=screen-256color-bce
Setting TERM (in-)directly
The problematic portion of this setting is the bce part, which stands for Background Color Erase and basically tells specific programs to erase background with the current background color as it was specific by the terminal emulator.
One way to go is surely to just omit the
-bce portion of setting the
environment variable. It could look like this:
# In screenrc: term screen-256color # In tmux.conf set -g default-terminal "screen-256color" # Shell equivalent: export TERM=screen-256color
However that could yield some problems when using gnu screen. As far as i know some keymappings and related settings in vim are not available without bce being set.
Fixing inside of vim
If that is a problem for you, you could just solve that problem from inside vim, instead of setting the environment variable.
If you just need a fix right now perform this from normal mode:
After that you'll need to call
:redraw! in order to, well, redraw the screen.
This should fix your problems for now.
For a more permanent solution you can add this line to your vimrc (I suggest to
add the comment as well, as
t_ut is not really a speaking variable name):
" Deactivate 'clearing uses the current background color', with " background color referring to the background color that was being " set by the terminal emulator. set t_ut=
Whichever way you want to go, it should yield a result like this: