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 tty" 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=0 # t_C0=2 turns off MOST colors, 0 kills all
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=0 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. I also tried using the "nosyntax.vim" file in /usr/share/vim/vim63/syntax, and even downloaded a "black and white" color scheme from https://www.vim.org/scripts/script.php?script_id=335, but vim still stubbornly would show colors for errors. Only the t_Co=0 worked.
To my mind, colorizing is pretty messed up..
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-04-13 Tony Lawrence
You learn about life by the accidents you have, over and over again, and your father is always in your head when that stuff happens. (Kurt Vonnegut)