tomtom/quickfixsigns_vim

Highlights should be (re)defined on colorscheme changes

blueyed opened this issue · 2 comments

This affects at least the vcsdiff highlights here:

hi QuickFixSignsDiffAdd ctermfg=0 ctermbg=2 guifg=black guibg=green
hi QuickFixSignsDiffDelete ctermfg=0 ctermbg=1 guifg=yellow guibg=red
hi QuickFixSignsDiffChange ctermfg=0 ctermbg=3 guifg=black guibg=yellow

After changing the colorscheme those get cleared (for me at least).

This can be done on ColorScheme.

Would you like a PR with that?

diff --git i/autoload/quickfixsigns/vcsdiff.vim w/autoload/quickfixsigns/vcsdiff.vim
index 2d803e5..3a4cf28 100644
--- i/autoload/quickfixsigns/vcsdiff.vim
+++ w/autoload/quickfixsigns/vcsdiff.vim
@@ -122,9 +122,16 @@ endif
 
 
 if g:quickfixsigns#vcsdiff#use_hidef && len(filter(values(g:quickfixsigns#vcsdiff#highlight), 'v:val =~# ''^QuickFixSignsDiff''')) > 0
-    hi QuickFixSignsDiffAdd    ctermfg=0 ctermbg=2 guifg=black  guibg=green
-    hi QuickFixSignsDiffDelete ctermfg=0 ctermbg=1 guifg=yellow guibg=red
-    hi QuickFixSignsDiffChange ctermfg=0 ctermbg=3 guifg=black  guibg=yellow
+    function! s:define_highlights() abort
+      hi QuickFixSignsDiffAdd    ctermfg=0 ctermbg=2 guifg=black  guibg=green
+      hi QuickFixSignsDiffDelete ctermfg=0 ctermbg=1 guifg=yellow guibg=red
+      hi QuickFixSignsDiffChange ctermfg=0 ctermbg=3 guifg=black  guibg=yellow
+    endfunction
+    augroup quickfixsigns_vcsdiff_highlights
+      au!
+      autocmd ColorScheme * call s:define_highlights()
+    augroup END
+    call s:define_highlights()
 endif

Could not find other places - other highlights are linked? (but I only quickly grepped).

Thanks!