I'm trying to use a vim while inside a screen session. For some reason, the background color for the parts of the screen without text are displaying as dark while the parts with text are displaying as light (screenshot below). When I switch the bg to dark (set bg=dark), everything is fine, but that's not really what I want. I should point out that everything works as expected when not in a screen session.

I'm happy to provide bash/vim/screen rc files if it would be helpful, but I won't blindly paste them all in here unless asked.

vim screenshot


No. set t_Co=256 is not the solution, setting up your terminal emulator and screen is the solution.

Assuming your terminal emulator is set to advertise itself as xterm-256color, you only have to add this line to ~/.screenrc:

term "screen-256color"
  • You're probably right here. Unfortunately, I'm using a script with screen that prevents me from doing the correct thing at the moment and fixing that script is a lower priority at the moment than a quick and dirty fix. – Wesley Bland Dec 17 '13 at 18:14

I ended up finding the answer. I needed to add

set t_Co=256

to my .vimrc and that fixed the issue.


Inside screen or tmux, the value of $TERM needs to begin with screen, not xterm.

See Vim not colouring the end of lines when run inside screen for the same question, and also a detailed explanation of the answer.

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.