I want to try out a 256 color scheme in vim but I cannot get any to work. At best I think my vim is capable of only 16 colors which I tested with:
I have tried using urxvt and xterm and I get the same result. I have tried setting my $TERM to one of:
rxvt-unicode-256color rxvt-256color xterm-256color screen-256color
After reading several tutorials and suggestions, "tput colors" returns 256 and running 256colors2.pl displays the colors correctly in the terminal. In vim, ":set t_Co?" returns 256 (I do not specify that in my vimrc) and ":echo $TERM" shows $TERM is set as expected (one of the above).
I created a new user to test with and that has the same problem. I asked on #vim but they were stumped.
Is it really that hard to get vim to display a 256 color scheme? Any help appreciated, thanks.
PGP key: F40D2072
Key fingerprint: 8742 F753 5E7B 394A 1B04 8163 332C 9C40 F40D 2072
Getting vim to work with colors from a terminal is a little tricky. Many colorschemes are written for gvim only and won't work correctly from a terminal.
Have you set vim's terminal options with ':set t_Co=256' ? To avoid setting vim to 256 colors in a linux terminal, I have this in my .vimrc:
" Use 256 color when using xterm or urxvt. " A $WINDOWID only exists when using X. if exists($WINDOWID) set t_Co=256 endif syntax on " Add syntax highlighting.
I have $TERM set in my X resources files with:
! Equivalent to 'xterm -tn xterm-256color' at the command line. xterm*termName: xterm-256color
Urxvt automatically starts with $TERM set as 'rxvt-unicode-256color' with my setup. I haven't explicitly set it.
Screen, from an xterm, won't display 256 colors in vim unless I start screen with:
$ screen -T xterm-256color
I'm not sure what the trick is to get vim with 256 colors when using screen from urxvt.