Do not adjust SignColumn highlight

This was introduced in 07d7c9d4 because many colorschemes at the time
had ugly sign columns, and people kept asking how to deal with it.

These days there are many more plugins which use the sign column and
consequently more colorschemes pay attention to the SignColumn highlight
group.

Therefore it no longer makes sense for vim-gitgutter to adjust the
sign column's appearance.

To restore the previous behaviour, add this to your vimrc:

    highlight! link SignColumn LineNr

See #696.
This commit is contained in:
Andy Stewart
2020-04-30 19:31:53 +01:00
parent f458f43cf2
commit 0da302c28a
4 changed files with 19 additions and 38 deletions

View File

@@ -290,19 +290,14 @@ Please note that vim-gitgutter won't override any colours or highlights you've s
#### Sign column #### Sign column
By default vim-gitgutter will make the sign column look like the line number column. Set the `SignColumn` highlight group to change the sign column's colour. For example:
To customise your sign column's background color, first tell vim-gitgutter to leave it alone:
```viml ```viml
let g:gitgutter_override_sign_column_highlight = 0 " vim-gitgutter used to do this by default:
``` highlight! link SignColumn LineNr
And then either update your colorscheme's `SignColumn` highlight group or set it in your vimrc: " or you could do this:
highlight SignColumn guibg=whatever ctermbg=whatever
```viml
highlight SignColumn ctermbg=whatever " terminal Vim
highlight SignColumn guibg=whatever " gVim/MacVim
``` ```
By default the sign column will appear when there are signs to show and disappear when there aren't. To always have the sign column, add to your vimrc: By default the sign column will appear when there are signs to show and disappear when there aren't. To always have the sign column, add to your vimrc:

View File

@@ -64,14 +64,6 @@ function! gitgutter#highlight#linenr_toggle() abort
endfunction endfunction
function! gitgutter#highlight#define_sign_column_highlight() abort
if g:gitgutter_override_sign_column_highlight
highlight! link SignColumn LineNr
else
highlight default link SignColumn LineNr
endif
endfunction
function! gitgutter#highlight#define_highlights() abort function! gitgutter#highlight#define_highlights() abort
let [guibg, ctermbg] = s:get_background_colors('SignColumn') let [guibg, ctermbg] = s:get_background_colors('SignColumn')

View File

@@ -306,7 +306,6 @@ Signs:~
|g:gitgutter_sign_removed| |g:gitgutter_sign_removed|
|g:gitgutter_sign_removed_first_line| |g:gitgutter_sign_removed_first_line|
|g:gitgutter_sign_modified_removed| |g:gitgutter_sign_modified_removed|
|g:gitgutter_override_sign_column_highlight|
Hunk previews:~ Hunk previews:~
@@ -450,20 +449,6 @@ Defaults:
You can use unicode characters but not images. Signs must not take up more than You can use unicode characters but not images. Signs must not take up more than
2 columns. 2 columns.
*g:gitgutter_override_sign_column_highlight*
Default: 1
Controls whether to make the sign column look like the line-number column (i.e.
the |hl-LineNr| highlight group).
To customise your sign column's background color, first tell vim-gitgutter to
leave it alone:
>
let g:gitgutter_override_sign_column_highlight = 0
<
And then either update your colorscheme's |hlSignColumn| highlight group or set
it in your |vimrc|:
Desired appearance Command ~ Desired appearance Command ~
Same as line-number column highlight clear SignColumn Same as line-number column highlight clear SignColumn
@@ -596,8 +581,11 @@ c. Why can't I unstage staged changes?
d. Why are the colours in the sign column weird? d. Why are the colours in the sign column weird?
Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly. Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly.
Please see |g:gitgutter_override_sign_column_highlight| on customising the Here are two ways you could change the colours:
sign column. >
highlight! link SignColumn LineNr
highlight SignColumn guibg=whatever ctermbg=whatever
<
e. What happens if I also use another plugin which uses signs (e.g. Syntastic)? e. What happens if I also use another plugin which uses signs (e.g. Syntastic)?

View File

@@ -22,6 +22,13 @@ function! s:set(var, default) abort
endif endif
endfunction endfunction
function! s:obsolete(var)
if exists(a:var)
call gitgutter#utility#warn(a:var.' is obsolete and has no effect.')
endif
endfunction
call s:set('g:gitgutter_preview_win_location', 'bo') call s:set('g:gitgutter_preview_win_location', 'bo')
if exists('*nvim_open_win') if exists('*nvim_open_win')
call s:set('g:gitgutter_preview_win_floating', 1) call s:set('g:gitgutter_preview_win_floating', 1)
@@ -44,7 +51,7 @@ if (has('nvim-0.4.0') || exists('*sign_place')) && !exists('g:gitgutter_sign_all
let g:gitgutter_sign_allow_clobber = 1 let g:gitgutter_sign_allow_clobber = 1
endif endif
call s:set('g:gitgutter_sign_allow_clobber', 0) call s:set('g:gitgutter_sign_allow_clobber', 0)
call s:set('g:gitgutter_override_sign_column_highlight', 1) call s:obsolete('g:gitgutter_override_sign_column_highlight')
call s:set('g:gitgutter_sign_added', '+') call s:set('g:gitgutter_sign_added', '+')
call s:set('g:gitgutter_sign_modified', '~') call s:set('g:gitgutter_sign_modified', '~')
call s:set('g:gitgutter_sign_removed', '_') call s:set('g:gitgutter_sign_removed', '_')
@@ -90,7 +97,6 @@ if !empty(g:gitgutter_grep)
endif endif
endif endif
call gitgutter#highlight#define_sign_column_highlight()
call gitgutter#highlight#define_highlights() call gitgutter#highlight#define_highlights()
call gitgutter#highlight#define_signs() call gitgutter#highlight#define_signs()
@@ -267,7 +273,7 @@ augroup gitgutter
autocmd VimResume * call gitgutter#all(1) autocmd VimResume * call gitgutter#all(1)
endif endif
autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights() autocmd ColorScheme * call gitgutter#highlight#define_highlights()
" Disable during :vimgrep " Disable during :vimgrep
autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0 autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0