Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been trying out a few different vim color schemes but none of them ever look like the picture (they seem very dry, not as colorful). I have tried messing with all the "profile preferences" on terminal but they don't seem to fix the color issue. I'm on Ubuntu 11.04 Beta 1. Any suggestions are appreciated.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The ANSI X3.64 standard only specifies 16 colors, and it's what Xterm declares in its terminfo description for "xterm". (GNOME Terminal is Xterm-compatible and uses the same terminfo description too.)

Current versions of both Xterm and GNOME Terminal have a 256-color mode. Since most programs use terminfo to decide whether to use 256 colors, you need to set $TERM apropriately. For example, if it was xterm, change it to xterm-256color.

export TERM="xterm-256color"

Restart vim after running this command.


One way to do this permanently is to add the following to your ~/.bashrc file:

case $TERM in
    xterm|screen|rxvt-unicode)
        TERM="${TERM}-256color" ;;
esac

It is, of course, even better to configure this setting in the terminal emulator itself (e.g. XTerm*termName), but some terminals have it hardcoded (as with gnome-terminal), in which case ~/.bashrc is acceptable as long as it doesn't set the new value blindly.


Inside vim, you can use :set t_Co? to check whether it successfully detected 256 color mode. Do not change this value inside your .vimrc, though, as it would be very unreliable.


Of course, nothing can beat gvim, which as a graphical program can use the full 32-bit color range.

share|improve this answer
    
I tried working with what you posted, and it seems to be 256 colors. I am using gnome-terminal. Thanks! –  Shane Reustle Apr 8 '11 at 15:27
    
Cool, gvim lets me use the color schemes. I think I'll stick with the in-terminal version though. I like to keep everything in there ;) Thanks! –  Shane Reustle Apr 8 '11 at 15:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.