diff --git a/README.mkd b/README.mkd index 940c8a2..5d50635 100644 --- a/README.mkd +++ b/README.mkd @@ -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`. diff --git a/autoload/gitgutter/highlight.vim b/autoload/gitgutter/highlight.vim index f180acc..63bca72 100644 --- a/autoload/gitgutter/highlight.vim +++ b/autoload/gitgutter/highlight.vim @@ -1,5 +1,9 @@ function! gitgutter#highlight#define_sign_column_highlight() - highlight default link SignColumn LineNr + if g:gitgutter_override_sign_column_highlight + highlight! link SignColumn LineNr + else + highlight default link SignColumn LineNr + endif endfunction function! gitgutter#highlight#define_highlights() diff --git a/doc/gitgutter.txt b/doc/gitgutter.txt index 62bdba2..bff1c3c 100644 --- a/doc/gitgutter.txt +++ b/doc/gitgutter.txt @@ -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 diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 47ecb01..4f533a9 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -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', '+')