diffchar.vim
diffchar.vim copied to clipboard
Use a new highlight group instead of using SpecialKey directly
Hey, thanks for the great plugin :+1:
I have been using it alongside https://github.com/sainnhe/gruvbox-material and I have noticed that by default the diffs become hard to read, e.g. the diff
-a() =>
+abce()
becomes
I've narrowed it down to the fact that the SpecialKey
highlight is hard to read in gruvbox-material. I have opened an issue in that repo https://github.com/sainnhe/gruvbox-material/issues/85 but the author said that it's hard to fix it since there is no custom highlight group for such diffs and SpecialKey
is used directly, which they do not want to change the color of.
See https://github.com/sainnhe/gruvbox-material/issues/85#issuecomment-846324992 for more information and suggestions from the theme author.
Would it be possible to create a new highlight group for the inner-line diffs and link it to SpecialKey
, so that it is easier to customize the color of the highlights?
Thank you for using the plugin. I reproduced here and found a regression on version 8.9. I will fix it in the next version. Meanwhile, try to modify the line 73 of your autoload/diffchar.vim like this:
@@ -70,7 +70,7 @@
endfor
call filter(dh.0, '!empty(v:val)')
let dh.1 = (hs == 'C' || hs == 'T') ?
- \filter(copy(dh.0), 'v:key =~ "\\(fg\\|bg\\|sp\\)$"') : dh.0
+ \filter(copy(dh.0), 'v:key =~ "bg$"') : dh.0
let dh.2 = (hs == 'C') ? filter(copy(dh.1), 'v:key =~ "bg$"') :
\(hs == 'T') ? {} : dh.1
" diff_hlID() incorrectly returns (hlID() - 1) until nvim 0.4.0
Thanks! It does look better now:
Can I close this issue?
Yes, definitely! I will close it right away. Thanks for a reminder