256 Colours in Vim

Recently I've been looking at different vim colorschemes, after using vimdiff and finding I couldn't see half of the code. I've been using relaxedgreen for ages, and it is excellent but I find the blue really hard to see on my black background so I was in the market for an alternative.

Touring Colours in Vim

Please excuse the all-over-the-place spelling in this post, I'm British so "colour" is a word and "color" is a vim command. Confused? Me too

I grabbed two fantastic scripts - the Vim Color Sampler Pack and the rather awesome ScrollColors plugin which allows you to cycle through all your colorschemes and try them out.


Inconsistent Themes

On playing with scrollcolor I saw a few themes that I really liked, but they didn't apply when I set them in my .vimrc. After a while I realised some themes were working on the second pass, but not the first. Closer inspection showed that applying the vibrantink scheme made all future schemes work flawlessly, and when I looked at the source for that scheme, I saw that it was setting t_Co=256.

Forcing 256 Colours

I added this line to my .vimrc before the colorscheme setting:

:set t_Co=256
syntax on
colorscheme vividchalk

I suspect there are better ways to tell my terminal that it has 256 colours but for now, I'm happy and coding again (with vividchalk), which looks something like this:

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>