Override SignColumn highlight group by default.

Most colorschemes (e.g. solarized) don't give any thought to the
SignColumn highlight group so generally the sign column is ugly.

With this change vim-gitgutter defaults to making the sign column look
like the line number column.

Solarized users no longer need `highlight clear SignColumn` in their
vimrc :)

To stop vim-gitgutter from overriding the SignColumn highlight, add this
to your vimrc:

    let g:gitgutter_override_sign_column_highlight = 0
This commit is contained in:
Andy Stewart
2015-03-31 16:23:55 +02:00
parent 8345c35770
commit 07d7c9d478
4 changed files with 23 additions and 29 deletions

View File

@@ -183,24 +183,19 @@ Please note that vim-gitgutter won't override any colours or highlights you've s
#### Sign column
The background colour of the sign column is controlled by the `SignColumn` highlight group. This will be either set in your colorscheme or Vim's default.
By default vim-gitgutter will make the sign column look like the line number column.
To find out where it's set, and to what it's set, use `:verbose highlight SignColumn`.
If your `SignColumn` is not set (`:highlight SignColumn` gives you `SignColumn xxx cleared`), vim-gitgutter will set it to the same as your line number column (i.e. the `LineNr` highlight group).
To change your sign column's appearance, update your colorscheme or `~/.vimrc` like this:
* For the same appearance as your line number column: `highlight clear SignColumn`
* For a specific appearance on terminal Vim: `highlight SignColumn ctermbg=whatever`
* For a specific appearance on gVim/MacVim: `highlight SignColumn guibg=whatever`
If you use [solarized](https://github.com/altercation/vim-colors-solarized)-dark, try the following snippet in your `~/.vimrc`:
To customise your sign column's background color, first tell vim-gitgutter to leave it alone:
```viml
set background=dark
colorscheme solarized
highlight clear SignColumn
let g:gitgutter_override_sign_column_highlight = 0
```
And then either update your colorscheme's `SignColumn` highlight group or set it in your vimrc:
```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. If you would always like the sign column to be there, add `let g:gitgutter_sign_column_always = 1` to your `~/.vimrc`.

View File

@@ -1,5 +1,9 @@
function! gitgutter#highlight#define_sign_column_highlight()
if g:gitgutter_override_sign_column_highlight
highlight! link SignColumn LineNr
else
highlight default link SignColumn LineNr
endif
endfunction
function! gitgutter#highlight#define_highlights()

View File

@@ -130,23 +130,17 @@ set in your colorscheme.
SIGN COLUMN
The background colour of the sign column is controlled by the |hlSignColumn|
highlight group. This will be either set in your colorscheme or Vim's default.
By default vim-gitgutter will make the sign column look like the line number
column (i.e. the |hl-LineNr| highlight group).
To find out where it's set, and to what it's set, use:
To customise your sign column's background color, first tell vim-gitgutter to
leave it alone:
>
:verbose highlight SignColumn
let g:gitgutter_override_sign_column_highlight = 0
<
If your `SignColumn` is not set, i.e if
>
:highlight SignColumn " gives you `SignColumn xxx cleared`
<
vim-gitgutter will set it to the same as your line number column (i.e. the
|hl-LineNr| highlight group).
To change your sign column's appearance, update your colorscheme or |vimrc|
like this:
And then either update your colorscheme's |hlSignColumn| highlight group or set
it in your |vimrc|:
Desired appearance Command ~
Same as line number column highlight clear SignColumn

View File

@@ -32,6 +32,7 @@ call s:set('g:gitgutter_max_signs', 500)
call s:set('g:gitgutter_signs', 1)
call s:set('g:gitgutter_highlight_lines', 0)
call s:set('g:gitgutter_sign_column_always', 0)
call s:set('g:gitgutter_override_sign_column_highlight', 1)
call s:set('g:gitgutter_realtime', 1)
call s:set('g:gitgutter_eager', 1)
call s:set('g:gitgutter_sign_added', '+')