2

I have a problem with making vim show a colorscheme fully (like in gvim). I've read about how to enable 256 color mode in terminal and it vim, but somehow it just doesn't work. The state of now is:

:echo &t_Co returns 256

[~]$ tput colors
256
[~]$ echo $TERM
xterm-256color

Colortest shows all the colors: colortest

But yet, vim doesn't show grey20 color of the colorscheme, instead using the terminal background. I also tried changing it to grey without success: hi Normal

The system is ubuntu 14.04. and the terminal gnome terminal, although I've tried with terminator and tmux, with no success.

Any idea what could gone wrong?

  • And just for the next guy looking for colortest.vim: :so $VIMRUNTIME/syntax/colortest.vim – Peter V. Mørch Sep 23 '18 at 18:42
1

The colorscheme must be missing cterm definitions, the full highlight command should look like:

hi Normal cterm=NONE ctermfg=15 ctermbg=7 gui=NONE guifg=White guibg=grey20

If your terminal supports 256 colors, you might need color codes greater than 16.

If you have a true color terminal, you could add these settings instead to enable 24-bit compatibility:

set termguicolors

" Correct RGB escape codes for vim inside tmux
if !has('nvim') && $TERM ==# 'screen-256color'
  let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif

From the help for 'termguicolors':

Note that the cterm attributes are still used, not the gui ones.

Read more:

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.