I have few quetion about color scheme and terminals... The web is plenty of posts about it but I still does not understand the following:

After a fresh install of (g)vim on arch, I did a

$ vim new_file

then in vim I did


which result in several groups (the ones in :h highlight-default). More interestingly, they used colors that are not in my 16 terminals colors. I can see for instance

Folded ... ctermbg=82 ...

and the color shows the color number 82 of my terminal (confirmed with a printf "\033[48;5;82mTEST\n").

On the other side I have a minimal vimrc which only contain set t_CO=16 after the runtime! archlinux.vim. I also run vim inside urxvt-unicode where I put my funny 16 colors in the .Xressources. Also echo $TERM says "rxvt-unicode" without "-256color".

I don't understand why vim use these colors >=16 by default.

  • You might be interested in work/discussion on github.com/vim/colorschemes
    – D. Ben Knoble
    Mar 10 '21 at 20:39
  • Thanks for pointing to me these works/discussions. I will take a deeper look. Nevertheless this does not explain the behavior I explained since I am "syntax off" and :scriptnames doesnot loaded any of colorscheme related file. More interestingly, I open vim on tty2 (I am not specialist here about vocabulary) but in this case Folded group fall backs to ctermfg=6. In fact all colors are between 0 to 7. How can Obtain such behaviour with urxvt....
    – Airwan
    Mar 10 '21 at 23:06

rxvt is recognized as 88-color terminal, so Vim makes use of several codes below 88.

See here and below.

  • Very Nice! And thanks. Do you agree that :h cterm-colors should be updated?
    – Airwan
    Mar 11 '21 at 14:54
  • @Airwan No, I don't see what's wrong with them. Could you elaborate?
    – Matt
    Mar 11 '21 at 16:30
  • My mistake! I was confused with keywords used in colorscheme that I though doesn't point to the right color but it is not. But setting t_Co=16 it would be nice to use color_number_16() instead of 88... I don't really understand the choice of assuming urxvt to be 88-colors terminal :o
    – Airwan
    Mar 11 '21 at 16:37
  • @Airwan If you have set t_Co=16 then all cterm colors must be under 16.
    – Matt
    Mar 11 '21 at 17:09
  • Waaaw t_Co vs t_CO! I am so stupid... but a little less now :o
    – Airwan
    Mar 11 '21 at 19:10

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