From 0d16061c05d7f89ad7d4a49501fff389062cd826 Mon Sep 17 00:00:00 2001 From: Ghislain Rodrigues Date: Sun, 13 Oct 2019 20:06:47 +0200 Subject: [PATCH] Change the way syntax match is executed. If the match is executed based on the hard coded color (which should not be hard coded in the first place, mentioned in issue #1), a color code can have multiple matches if the hex code is used for multiple colors. This commit changes the matching as: ' \d+ #[0-9af]+', containing the xterm256 index of the color, so that the highlight class is independant from the used RGB code. --- plugin/xterm-color-table.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/xterm-color-table.vim b/plugin/xterm-color-table.vim index f6845b4..3da64ed 100644 --- a/plugin/xterm-color-table.vim +++ b/plugin/xterm-color-table.vim @@ -102,7 +102,7 @@ function! s:ColorCell(n) execute 'silent! syntax clear bg_' . a:n execute 'syntax match fg_' . a:n . ' " ' . a:n . ' " containedin=ALL' - execute 'syntax match bg_' . a:n . ' "' . rgb . '" containedin=ALL' + execute 'syntax match bg_' . a:n . ' " ' . a:n . ' #[a-f0-9]\{6\}" containedin=ALL contains=fg_' . a:n call s:HighlightCell(a:n, -1)