4

I've been experimenting with different colorschemes in vim lately. My problem is that the colors used by the schemes only use the 16 colors in my Profile Preferences, even though my terminal supports a 256 palette.

When I put in tput colors it returns 256. I have my TERM variable set to xterm-256color. I have set t_Co=256 in my .vimrc. On this question How do I enable full-color support in Vim? there is a python script that will display your available colors. I see the full range of colors that the person shows in their screenshot.

Yet even after all of this, the colors in my vim are only the ones listed in Profile Preferences. I know this because I can change the colors and see the corresponding "darkgreen" (or whichever color I am selecting) font change to whatever color I changed it to.

So whenever I specify a colorscheme, it has the general look and appearance of it, but it's not exactly correct. I would like to have my color schemes look how they do in the screenshots I see of them.

Is it possible to do this or will I always have to manually change the 16 colors in my Profile Preferences to perfectly match a colorscheme?

I'm using the vim-gnome package in Ubuntu 14.04 with gnome-terminal. Thanks for any help.

Sterling
  • 215

1 Answers1

3

This is working in gnome-terminal + vim on Ubuntu 14.04:

Firstly, set the bash setting as the end of ~/.bashrc file like this:

if [ -n "$DISPLAY" -a "$TERM" == "xterm" ]; then
    export TERM=xterm-256color
fi

Next, set the vim setting at the end of ~/.vimrc file like this:

if $COLORTERM == 'gnome-terminal'
  set t_Co=256
endif

You will need to load a new terminal to see these have an effect. You may run the python script to test is the bash setting has taken effect and then testing vim's support, which I believe was the core issue above:

Install a 256 color vim theme by downloading the script and saving it to ~/.vim/colors/inkpot.vim and enable it with this command:

:colo inkpot

You should see a theme which when tested locally does not change when gnome-terminal's colours are changed. You can make these themes permanent by adding the command to your .vimrc file.

More information about vim colours can be found on their website.