This is an iEntry.com Website
Search iEntry News

Submit Your Site For Free!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

LinuxProNews
SecurityProNews
ITmanagement










Controlling Linux Colors In Vi (vim)

By A.P. Lawrence
Expert Author
Article Date: 2005-03-16

Because of an old application that apparently partially looks at termcap and partially hard-codes terminal info, a customer has to set TERM=ansi when using Alphacom to access his Linux box.

The Linux colorizing fouls things up royally. You can shut off command line colorizing by editing /etc/DIR_COLORS and changing "COLOR ttty" to "COLOR none" or (less drastically) by removing the "TERM ansi" line from the same file (which removes colorization for ansi but doesn't affect console use).

But that still leaves vi messing things up. The fix for that is to add

set t_Co=2

to the top of /etc/vimrc. I attempted to do this in ~/.vimrc but couldn't make it work, and also tried

if &term=="ansi"
  set t_Co=2
endif


in /etc/vimrc but that didn't work either.. not sure why yet. The idea there would be to let vim colorize if not using ansi, though in my case forcing it is fine because I don't want colors in vi ever.

I have seen the suggestion to "set syntax off"; that didn't work for me or the customer.

To my mind, colorizing is pretty messed up..

*Originally published at APLawrence.com

About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com



Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact