tomtom / quickfixsigns_vim

Mark quickfix & location list items with signs
http://www.vim.org/scripts/script.php?script_id=2584
GNU General Public License v3.0
131 stars 13 forks source link

Highlights should be (re)defined on colorscheme changes #78

Closed blueyed closed 7 years ago

blueyed commented 7 years ago

This affects at least the vcsdiff highlights here: https://github.com/tomtom/quickfixsigns_vim/blob/bda44072bd866cc9efb81092467dfdf976358050/autoload/quickfixsigns/vcsdiff.vim#L125-L127

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

This can be done on ColorScheme.

blueyed commented 7 years ago

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).

blueyed commented 7 years ago

Thanks!