I have a problem with colors when using vi under Ubuntu 12.04.

I'm connecting to my Ubuntu server from a PC, using PowerTerm terminal emulation software. I have PowerTerm set up to display black text on a grey background.

When I connect to the Ubuntu box, the screen is fine. When I open a file with vi, the screen is fine. The text is black on a gray background, which is normal for my PowerTerm setup. However, if the file is less than a full screen long, the remainder of the screen is a black background. When I quit vi, the entire background turns black, and the text becomes white. I have to do a Terminal Reset to restore my normal text and background colors.

What I want is for there to be no change at all when I use vi. The text should be black and the background grey. I have another server loaded with RedHat 9, and that acts normally; colors don’t change when using vi.

Here is my .vimrc file:

set compatible
syntax off
let g:loaded_matchparen=1
set nocp
set noincsearch
set nohlsearch
set noshowmatch
set bg=dark

I've tried set bg=dark and set bg=light. It makes no difference. Is there some other set command that would clear this up for me, or some TERM setting (my TERM is set to linux)?


You just need to keep the TERM setting same in both the computers. So just change it to whatever is in the server.

Note that you should keep the set t_Co=256 setting in .vimrc for it to work properly, esp when connected remotely.

|improve this 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.