Katpoes
Katpoes

Reputation: 209

Inconsistent vim highlighting throughout various syntax

I'm building a color scheme from scratch and as I came past the syntax group I noticed a lot of inconsistency overall.

hi Comment      ctermfg=129  ctermbg=129  cterm=italic     
hi Boolean      ctermfg=3    ctermbg=none cterm=bold   

The comments are basically ignored as they should be both purple and italic, instead they're both a different color and not italic. The booleans as well both show a different color but they do appear to be bold.

enter image description here

hi String       ctermfg=10   ctermbg=none cterm=italic 

The string on the other hand has no trouble whatsoever.

enter image description here

I used a Javascript and Python file for testing here but it messes up everywhere (CSS, HTML, Rust, C, Shell).

I'm using rxvt-unicode and have no trouble assigning the purple color to the string.

Kind of unsure on how to proceed here. What could be the problem?

Upvotes: 0

Views: 393

Answers (1)

mMontu
mMontu

Reputation: 9273

First ensure that you are looking at the correct line, i.e., that code is using the highlight group that you think it should. You could use the following mapping from the vim tips:

map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
            \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
            \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>

By hitting F10 it will display the highlight group off the word under the cursor.

If the problem remains you could:

  1. switch the terminal to check if it the problem is specific to urxvt
  2. ensure that no plugin/setting is interfering by following the procedure on Vim FAQ 2.5 - "I have a "xyz" (some) problem with Vim. How do I determine it is a problem with my setup or with Vim? / Have I found a bug in Vim?"
  3. check the Vim FAQ on syntax highlighting

You may also be interested on ColorSchemeEditor plugin:

This plugin provides a GUI tool which simplifies creating/editing Vim colorscheme files. It consists of a Vim plugin as well as a Python program, and utilizes Vim's command server interface |clientserver| for communications.

Upvotes: 1

Related Questions