For most vim colorschemes, they appear different than advertised when I open vim in xterm.

I've been using xterm-256color and set t_Co=256.

A similar thing happens when I use xfce-terminal, but the colors in the colorschemes will vary depending on which colors I set in the terminal's preferences menu. I've read that some colorschemes will rely on terminal colors, and that appears to be what's happening here.

Is there a way to prevent the vim colorscheme from conflicting with the terminal one?

  • can't you define those proprieties in bashrc?
    – vfbsilva
    Jan 14 '15 at 18:13
  • What do you mean, the vim colors? Also, after more reading the simplest solution seems to be using something newer than xterm.
    – al92
    Jan 14 '15 at 18:15
  • As vim runs in a 256 color terminal it will be limited to the 256 colors the terminal uses, and there is no full RGB terminal I am aware of so @al92's suggestion is unlikely to be possible. The closest you can get is to come up with a scripted command to change terminal colors and arrange to have it run every time you open and close vim to set and reset the terminal colors.
    – jw013
    Jan 14 '15 at 18:24

Unless you use the mostly experimental support for full RBG-colors in some terminals, you're limited to the indexed 256 color palette provided by the terminal. You're right that terminals may slightly deviate in the exact colors used, and that will be noticeable. If you completely reassign colors (turn red into blue etc.), there's nothing that corrects this in Vim, as Vim will ignorantly request "color at index #42".

If the differences are only in the basic 16 colors and the rest of the palette is correct and you use a colorscheme with both GUI and cterm definitions, you can work around this via plugins like CSApprox, which take the GUI color definitions and convert them to a closely matching 256-color cterm color palette for high-color terminals.

Another approach is taken by csexact, which modifies the (supported) terminal's palette to exactly match Vim's GUI colors. If your terminal is supported, that may be worth a try.


You could try the settings I have on my mac for my ~/.vimrc file:

" => Colors and Fonts
syntax enable

colorscheme desert
set background=dark

" Set extra options when running in GUI mode
if has("gui_running")
    set guioptions-=T
    set guioptions+=e
    set t_Co=256
    set guitablabel=%M\ %t

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8

" Use Unix as the standard file type
set ffs=unix,dos,mac

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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