[vim/vim] ColorColumn being rendered over by highlight match. (#8017)

108 views
Skip to first unread message

Cole

unread,
Mar 27, 2021, 4:14:06 AM3/27/21
to vim/vim, Subscribed

The simple .vimrc file below highlights trailing tabs or spaces within a line.
This .vimrc will cause a space/tab to be match'd to a highlight and appear as a red under line.
When a alpha-numeric is pressed the spaces/tabs will no longer trail and subsequently they will revert back to the default color.

The error shows when trailing spaces/tabs are being rendered after a match and go over a ColorColumn.
The rendering does not appear to honour the guibg=NONE and the ColorColumn gets rendered over.
When they are not matched the ColorColumn is rendered.

cat ~/.vimrc

set termguicolors
set cursorline
hi clear
s
" terminal column
set cc=10
hi ColorColumn guibg=#1E1E1E

hi GroupTrailingSpace guifg=red guibg=NONE
match GroupTrailingSpace /\s\+$/
2match GroupTrailingSpace /\t\+$/

The image below hopefully highlights the issue.

  1. The spaces are being match'd prior reaching the ColorColumn.
  2. The spaces are being match'd and bypassing the ColorColumn. The ColorColumn is being hidden.
  3. The spaces are not being matched as 'ABC' are now the trailing characters. The ColorColumn has rendered again !
    vim-ColumnColor-bug

I found something similiar for ColorColumn and foldtext.
http://vim.1045645.n5.nabble.com/colorcolumn-and-foldtext-tt5724274.html

Debian GNU/Linux 10 (buster)
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 27 2021 07:58:34)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Mar 27, 2021, 7:39:23 AM3/27/21
to vim/vim, Subscribed

The idea of the color column is that it's an indication of some column, which has low priority.
Other things highlighted in the text usually have higher priority.
That the match for trailing spaces overrules it is to be expected.
If we would change this I'm sure someone else has an example where that is not wanted.

Cole

unread,
Mar 27, 2021, 9:22:35 AM3/27/21
to vim/vim, Subscribed

I thought a highlight match specifying guibg=#SOMECOLOR would overrule the ColorColumn background but guibg=NONE would allow the lower priority ColorColumn background through into the foreground.

Reply all
Reply to author
Forward
0 new messages