From 3fb9a59a061cad94dd889e9af7f911f2301a4520 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Sat, 25 Apr 2020 13:51:29 +0100 Subject: [PATCH] Handle existing GitGutter* highlight groups which are links Fixes #701. --- autoload/gitgutter/highlight.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/gitgutter/highlight.vim b/autoload/gitgutter/highlight.vim index ed63f29..fb5952e 100644 --- a/autoload/gitgutter/highlight.vim +++ b/autoload/gitgutter/highlight.vim @@ -89,7 +89,12 @@ function! gitgutter#highlight#define_highlights() abort " set their backgrounds to the sign column's. for type in ["Add", "Change", "Delete"] if hlexists("GitGutter".type) - execute "highlight GitGutter".type." guibg=".guibg." ctermbg=".ctermbg + " Were the highlight self-contained we could just declare the + " background attributes and they would be merged. But it might be a + " link, in which case it would be overwritten. So re-declare it in its + " entirety. + let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type) + execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg endif endfor