Update: it works, if I set the main bg color (white) as ctermbg=231 (it was 015). So it seems that color values in Vim syntax highlight settings shouldn't be mixed: if one uses color codes from the 16 color palette, he should use it consistently.

cursor line color is correct

The question then boils down to:

why it used to work with mixed values just a couple of weeks ago?

Original post:

I have a problem: Vim doesn't display some highlight colors, at least the 255 one (slightly grey). Color 022 (greenish) is displayed, which I assume means that the 256 colors are supported, since 022 doesn't belong to the system colors according to the xterm colors chart. Could someone please advise something about this. Either how this can be fixed, or where should I look to fix it?

Some details: I seem to have all necessary settings in both the terminal (Gnome terminal 3.36.2, as well as Terminator) and Vim.

In the bashrc:

export TERM='xterm-256color'

In the vimrc (this is the complete file, for purposes of reproducing the issue):

set nocompatible
set t_Co=256
set t_ut=
set cursorline
colorscheme default
set syntax=vim

hi Normal ctermbg=015 ctermfg=000
hi CursorLine cterm=none ctermbg=255 ctermfg=000

"set notermguicolors
"set termencoding=utf-8
"set term=xterm-256color
"set background=light

The commented options have been tried with various values in various combinations, which didn't affect the issue in any way.

  1. The terminals I tried show colors correctly (I in purpose added the white color to the grayscale ramp line to see that color 255 and color 231 are displayed distinctly):

perl script output to show 256 colors

As one can see, the terminal displays all the colors, including the white (231) and slightly grey (255).

  1. When I start vim vim -u ~/Documents/vimrc --noplugin ~/Documents/vimrc to edit the vimrc file shown above, I see no cursor line, though it's set:

vim no cursor line color

  1. But if I change ctermbg to 022, it works:

vim cursor line color is correct

I also have tried other colors: 225, 051 — it worked. But color 255 doesn't.

  1. The issue seems to have no relation to the CursorColumn syntax group, since other groups don't display color 255 too.

  2. It all used to work a couple of weeks ago on the same system, with probably the same vim binary and the same vimrc file. But since I had a data loss I freshly installed Fedora 32 and now am trying to restore my vim config:

    • the bashrc file is lost, so I might have some setting there, which affected the issue;
    • the vim directory with after/* scripts is lost (though it must have been empty);

I've searched in all set options for '256', '16' and 'color' and found nothing. So I virtually have no idea what the cause of this might be. Could someone give an advice? Thank you in advance.



Your Answer

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

Browse other questions tagged or ask your own question.