mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Do not set background on existing GitGutter* highlights unless requested
If GitGutter* highlight groups already exist, they were declared
deliberately (either by the colorscheme maintainer or the user). So do
not adjust them.
However if you would like to make the signs' backgrounds match the sign
column, you can do this:
let g:gitgutter_set_sign_backgrounds = 1
This commit is contained in:
10
README.mkd
10
README.mkd
@@ -316,13 +316,15 @@ let g:gitgutter_sign_allow_clobber = 1
|
||||
|
||||
#### Signs' colours and symbols
|
||||
|
||||
If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use those for the signs' colours.
|
||||
If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use them for the signs' colours.
|
||||
|
||||
Otherwise it will use your colourscheme's `Diff*` highlight groups.
|
||||
If you want the background colours to match the sign column, but don't want to update the `GitGutter*` groups yourself, you can get the plugin to do it:
|
||||
|
||||
Either way the signs' background colours will be set to the sign column's background colour.
|
||||
```viml
|
||||
let g:gitgutter_set_sign_backgrounds = 1
|
||||
```
|
||||
|
||||
If you don't like the colours, specify the ones you want in your vimrc (see `:help highlight-guifg` and `:help highlight-ctermfg`). For example, to get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
|
||||
If no `GitGutter*` highlight groups exist, the plugin will check the `Diff*` highlight groups. If their foreground colours differ the plugin will use them; if not, these colours will be used:
|
||||
|
||||
```viml
|
||||
highlight GitGutterAdd guifg=#009900 ctermfg=2
|
||||
|
||||
@@ -76,11 +76,12 @@ function! gitgutter#highlight#define_highlights() abort
|
||||
highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible
|
||||
|
||||
" When they are visible.
|
||||
|
||||
" The background colours are set to the sign column's.
|
||||
for type in ["Add", "Change", "Delete"]
|
||||
if hlexists("GitGutter".type)
|
||||
let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type)
|
||||
if g:gitgutter_set_sign_backgrounds
|
||||
execute "highlight GitGutter".type." guibg=".guibg." ctermbg=".ctermbg
|
||||
endif
|
||||
continue
|
||||
elseif s:useful_diff_colours()
|
||||
let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type)
|
||||
else
|
||||
|
||||
@@ -306,6 +306,7 @@ Signs:~
|
||||
|g:gitgutter_sign_removed|
|
||||
|g:gitgutter_sign_removed_first_line|
|
||||
|g:gitgutter_sign_modified_removed|
|
||||
|g:gitgutter_set_sign_backgrounds|
|
||||
|
||||
Hunk previews:~
|
||||
|
||||
@@ -449,12 +450,14 @@ Defaults:
|
||||
You can use unicode characters but not images. Signs must not take up more than
|
||||
2 columns.
|
||||
|
||||
*g:gitgutter_set_sign_backgrounds*
|
||||
Default: 0
|
||||
|
||||
Desired appearance Command ~
|
||||
Same as line-number column highlight clear SignColumn
|
||||
User-defined (terminal Vim) highlight SignColumn ctermbg={whatever}
|
||||
User-defined (graphical Vim) highlight SignColumn guibg={whatever}
|
||||
Only applies to existing GitGutter* highlight groups. See
|
||||
|gitgutter-highlights|.
|
||||
|
||||
Controls whether to override the signs' background colours to match the
|
||||
|hl-SignColumn|.
|
||||
|
||||
*g:gitgutter_preview_win_floating*
|
||||
Default: 0 (Vim)
|
||||
@@ -526,6 +529,10 @@ To change the signs' colours, specify these highlight groups in your |vimrc|:
|
||||
|
||||
See |highlight-guifg| and |highlight-ctermfg| for the values you can use.
|
||||
|
||||
If you do not like the signs' background colours and you do not want to update
|
||||
the GitGutter* highlight groups yourself, you can get the plugin to do it
|
||||
|g:gitgutter_set_sign_backgrounds|.
|
||||
|
||||
To change the line highlights, set up the following highlight groups in your
|
||||
colorscheme or |vimrc|:
|
||||
>
|
||||
|
||||
@@ -52,6 +52,7 @@ if (has('nvim-0.4.0') || exists('*sign_place')) && !exists('g:gitgutter_sign_all
|
||||
endif
|
||||
call s:set('g:gitgutter_sign_allow_clobber', 0)
|
||||
call s:obsolete('g:gitgutter_override_sign_column_highlight')
|
||||
call s:set('g:gitgutter_set_sign_backgrounds', 0)
|
||||
call s:set('g:gitgutter_sign_added', '+')
|
||||
call s:set('g:gitgutter_sign_modified', '~')
|
||||
call s:set('g:gitgutter_sign_removed', '_')
|
||||
|
||||
Reference in New Issue
Block a user