Skip to content

Commit

Permalink
Make always-showing-the-sign-column opt-in.
Browse files Browse the repository at this point in the history
This is consistent with Vim's default behaviour.
  • Loading branch information
airblade committed Mar 14, 2013
1 parent 15ee31a commit 3f107f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ See the customisation section below for how to change the defaults.
You can customise:

* The sign column's colours
* Whether or not the sign column is shown when there aren't any signs (defaults to no)
* The signs' colours
* Line highlights
* Whether or not vim-gitgutter is on initially (defaults to on)
Expand All @@ -93,6 +94,8 @@ To change your sign column's appearance, update your colorscheme or `~/.vimrc` l
* For a specific appearance on terminal Vim: `highlight SignColumn ctermbg=whatever`
* For a specific appearance on gVim/MacVim: `highlight SignColumn guibg=whatever`

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`.


#### Signs' colours

Expand Down Expand Up @@ -134,6 +137,10 @@ Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.

> Why does the window flicker when the signs are redrawn?
This happens on certain combinations of OS and Vim. You can prevent the flicker by adding `let g:gitgutter_sign_column_always = 1` to your `~/.vimrc`.

> Why is no sign shown if I delete the first line(s) in a file?
vim-gitgutter shows removed lines with a sign on the line above. In this case there isn't a line above so vim-gitgutter can't show the sign.
Expand Down
8 changes: 7 additions & 1 deletion plugin/gitgutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ if !exists('g:gitgutter_highlight_lines')
endif
let s:highlight_lines = g:gitgutter_highlight_lines

if !exists('g:gitgutter_sign_column_always')
let g:gitgutter_sign_column_always = 0
endif

function! s:init()
if !exists('g:gitgutter_initialised')
call s:define_sign_column_highlight()
Expand Down Expand Up @@ -368,7 +372,9 @@ function! GitGutter()
let s:hunks = s:parse_diff(diff)
let modified_lines = s:process_hunks(s:hunks)
let file_name = s:current_file()
call s:add_dummy_sign()
if g:gitgutter_sign_column_always
call s:add_dummy_sign()
endif
call s:clear_signs(file_name)
call s:find_other_signs(file_name)
call s:show_signs(file_name, modified_lines)
Expand Down

0 comments on commit 3f107f9

Please sign in to comment.