Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CursorLine and NonText / SpecialKey highlight clash

Tags:

vim

With :set cursorline and :set list, the characters in the NonText and SpecialKey highlight groups (for example, $ at the end of each line, and ^M produced by Ctrl+VEnter) lose their highlighting when the cursor is on the same line, reverting to the Normal highlight group like any other bland text. This is very confusing and ugly and bad.

These are the relevant highlights in my config:

:hi Conceal      term=reverse    cterm=none      ctermfg=237     ctermbg=none
:hi CursorLine   term=underline  cterm=none      ctermfg=none    ctermbg=235
:hi NonText      term=reverse    cterm=none      ctermfg=237     ctermbg=none
:hi Normal       term=none       cterm=none      ctermfg=252     ctermbg=234
:hi SpecialKey   term=reverse    cterm=none      ctermfg=14      ctermbg=23

The problem persists no matter my highlight configuration (including no configuration at all). I know that some highlight groups just always trump others, but syntax highlighting and highlighting from other groups (Conceal, for example) remains intact; is there a way to make NonText and SpecialKey retain their highlight?

like image 962
Quinn Strahl Avatar asked Apr 12 '13 20:04

Quinn Strahl


1 Answers

As far as I'm aware, no. Bram Moolenaar has said the following on this matter:

There is no solution. [...] The cursorline highlighting needs to overrule the syntax highlighting, otherwise it would disappear in several situations, esp. if the syntax highlighting uses background highlighting.

like image 69
Nikita Kouevda Avatar answered Oct 02 '22 06:10

Nikita Kouevda