Skip to content

Commit

Permalink
Change the way syntax match is executed.
Browse files Browse the repository at this point in the history
If the match is executed based on the hard coded color (which should not
be hard coded in the first place, mentioned in issue guns#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.
  • Loading branch information
padawin committed Oct 13, 2019
1 parent 9754e85 commit 0d16061
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/xterm-color-table.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 0d16061

Please sign in to comment.