From 3f107f97daeddf10b3d5e1e1e6547f5e9e9a23d4 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Thu, 14 Mar 2013 09:34:25 +0100 Subject: [PATCH] Make always-showing-the-sign-column opt-in. This is consistent with Vim's default behaviour. --- README.mkd | 7 +++++++ plugin/gitgutter.vim | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.mkd b/README.mkd index 4d4341d..4b8e175 100644 --- a/README.mkd +++ b/README.mkd @@ -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) @@ -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 @@ -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. diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index dab88e8..3291990 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -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() @@ -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)