mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Make always-showing-the-sign-column opt-in.
This is consistent with Vim's default behaviour.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user