I notice one of my linux remote login window shows color in VI editor interface but another window doesn't show color. These 2 windows are remotely connected to 2 different server IP addresses.


May I know why and how to change the color of the VI screen? I am using Putty on Windows 7 to remotely access the linux server.

  • Have you checked the settings in your PuTTY program? Maybe the settings are different for each login. I know you can change the color in PuTTY.
    – Kevdog777
    Jul 20, 2012 at 15:01

3 Answers 3


You need to set your TERM in both to the same thing. If you use screen, those should be screen-256color-bce and if your terminal (urxvt for example) support 256 colours, you will get them. Note that vim requires set t_Co=256 in your ~/.vimrc to work properly.

I am assuming that you want colour to appear in all vi/vim windows. If not, just change your terminal (putty) to be black and white. You will then see no colours whatsoever.

  • Vim does not need explicit setting of the terminal's coloring capabilities if termcap or terminfo is set up correctly. That's what those are for. Setting t_Co=256 may actually be harmful when you run with a terminal that supports only 8 or 88 colors.
    – peth
    Mar 16, 2012 at 10:12
  • @user112553: Thank you for your clarification. Mar 16, 2012 at 10:13
  • i am NOT using VIM and I am using VI only. Could you give more hints on this termcap or terminfo thing?
    – Xianlin
    Mar 16, 2012 at 12:03
  • 1
    @Xianlin: As far as I know vi does not do colour highlighting. As for termcap/terminfo, this page should give you some information. Mar 16, 2012 at 12:36
  • I think probably when I type "vi" in the second terminal the linux (ubuntu) actually is using vim program for me because I may installed vim unconsciously on the second server...
    – Xianlin
    Mar 16, 2012 at 14:46

By default (at least on Fedora and other Redhat derivitives) vim-enhanced is installed and it adds a file /etc/profile.d/vim.sh

alias vi=vim

So in your .bashrc or manually you can unalias vi and you'll get the uncolored vi interface you expect. I put the following in my standard bashrc

unalias vi 2> /dev/null
  • I am using ubuntu but thank you and I learned something new...
    – Xianlin
    Mar 16, 2012 at 14:46

Using PuTTy , I unchecked the setting 'Allow terminal to specify ANSI colours' Under the Window=>Colours section. That did the trick without changing the background/foreground settings

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.