Vim: Setting the colorscheme Doesn't Work

If you've found a fancy colorscheme for vim and you want to try it out, once you've saved the colorscheme file to ~/.vim/colors you can enable the theme with the following in a vim session's command mode:

:colorscheme fruity

If you want the colorscheme to be permanent then you can set the name of the theme in your ~/.vimrc file with:

colorscheme fruity

However if this doesn't work then it's probably that your terminal doesn't support enough colors. Fixing the amount of colors the terminal can display is fairly easy by simply exporting the TERM environment variable to use the 256 color xterm. (Sadly this is not possible on OSX's leopard terminal as it only supports 16 colors though apparently iTerm does have 256 color support)

export TERM=xterm-256color

An alternative to this is to start vim with the terminal switch set to xterm-256color e.g:

vim -T xterm-256color

Once this is done the colorschemes should work just fine.

Simplying the colors used by gvim themes

Another issue that you can hit is when trying to use a gvim (gui version) theme in vim it may specify colors that don't fit within the range your terminal is capable of displaying. CSApprox is a plugin which converts the colors in gvim themes to the closest color that will work with your term see http://www.vim.org/scripts/script.php?script_id=2390 for more info.

comments powered by Disqus