mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Ensure good diff syntax highlighting in preview
Specifically, make it match the signs' foreground colours; and clear the
backgrounds so the GitGutter{Add,Delete}IntraLine highlights' "reverse"
colours work properly.
This commit is contained in:
10
README.mkd
10
README.mkd
@@ -633,16 +633,6 @@ This plugin is for showing changes between the buffer and the index (and staging
|
|||||||
|
|
||||||
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
|
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
|
||||||
|
|
||||||
> Why are the colours in the preview window weird?
|
|
||||||
|
|
||||||
Probably because your colourscheme doesn't configure the `diff{Added,Changed,Removed}` highlight groups. Try this in `after/syntax/diff.vim`:
|
|
||||||
|
|
||||||
```viml
|
|
||||||
highlight link diffAdded DiffAdd
|
|
||||||
highlight link diffChanged DiffChange
|
|
||||||
highlight link diffRemoved DiffDelete
|
|
||||||
```
|
|
||||||
|
|
||||||
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
|
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
|
||||||
|
|
||||||
You can configure whether GitGutter preserves or clobbers other signs using `g:gitgutter_sign_allow_clobber`. Set to `1` to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or `0` to preserve them.
|
You can configure whether GitGutter preserves or clobbers other signs using `g:gitgutter_sign_allow_clobber`. Set to `1` to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or `0` to preserve them.
|
||||||
|
|||||||
@@ -116,11 +116,12 @@ function! gitgutter#highlight#define_highlights() abort
|
|||||||
" Highlights used intra line.
|
" Highlights used intra line.
|
||||||
highlight GitGutterAddIntraLine gui=reverse cterm=reverse
|
highlight GitGutterAddIntraLine gui=reverse cterm=reverse
|
||||||
highlight GitGutterDeleteIntraLine gui=reverse cterm=reverse
|
highlight GitGutterDeleteIntraLine gui=reverse cterm=reverse
|
||||||
" Set default diff colours for the preview window (some colourschemes forget this).
|
" Set diff syntax colours (used in the preview window) - diffAdded,diffChanged,diffRemoved -
|
||||||
" highlight default link diffAdded DiffAdd
|
" to match the signs.
|
||||||
" highlight default link diffChanged DiffChange
|
for [dtype,type] in [['Added','Add'], ['Changed','Change'], ['Removed','Delete']]
|
||||||
" highlight default link diffRemoved DiffDelete
|
let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type)
|
||||||
|
execute "highlight diff".dtype." guifg=".guifg." ctermfg=".ctermfg." guibg=NONE ctermbg=NONE"
|
||||||
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! gitgutter#highlight#define_signs() abort
|
function! gitgutter#highlight#define_signs() abort
|
||||||
|
|||||||
Reference in New Issue
Block a user