mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Fix bug preventing configurable off-by-default.
This commit is contained in:
@@ -30,6 +30,8 @@ git clone git://github.com/airblade/vim-gitgutter.git
|
|||||||
|
|
||||||
You don't have to do anything: it just works.
|
You don't have to do anything: it just works.
|
||||||
|
|
||||||
|
If you want vim-gitgutter off by default, add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
|
||||||
|
|
||||||
You can explicitly turn vim-gitgutter off and on:
|
You can explicitly turn vim-gitgutter off and on:
|
||||||
|
|
||||||
* turn off with `:call DisableGitGutter()`
|
* turn off with `:call DisableGitGutter()`
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ let g:loaded_gitgutter = 1
|
|||||||
|
|
||||||
" Initialisation {{{
|
" Initialisation {{{
|
||||||
|
|
||||||
let s:gitgutter_enabled = 1
|
if !exists('g:gitgutter_enabled')
|
||||||
|
let g:gitgutter_enabled = 1
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:init()
|
function! s:init()
|
||||||
if !exists('g:gitgutter_initialised')
|
if !exists('g:gitgutter_initialised')
|
||||||
@@ -49,10 +51,6 @@ endfunction
|
|||||||
|
|
||||||
" Utility {{{
|
" Utility {{{
|
||||||
|
|
||||||
function! s:is_gitgutter_enabled()
|
|
||||||
return s:gitgutter_enabled
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:update_line_highlights(highlight_lines)
|
function! s:update_line_highlights(highlight_lines)
|
||||||
let s:highlight_lines = a:highlight_lines
|
let s:highlight_lines = a:highlight_lines
|
||||||
call s:define_signs()
|
call s:define_signs()
|
||||||
@@ -236,7 +234,7 @@ endfunction
|
|||||||
" Public interface {{{
|
" Public interface {{{
|
||||||
|
|
||||||
function! GitGutter()
|
function! GitGutter()
|
||||||
if s:is_gitgutter_enabled() && s:exists_current_file() && s:is_in_a_git_repo() && s:is_tracked_by_git()
|
if g:gitgutter_enabled && s:exists_current_file() && s:is_in_a_git_repo() && s:is_tracked_by_git()
|
||||||
call s:init()
|
call s:init()
|
||||||
let diff = s:run_diff()
|
let diff = s:run_diff()
|
||||||
let hunks = s:parse_diff(diff)
|
let hunks = s:parse_diff(diff)
|
||||||
@@ -249,17 +247,17 @@ function! GitGutter()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! DisableGitGutter()
|
function! DisableGitGutter()
|
||||||
let s:gitgutter_enabled = 0
|
let g:gitgutter_enabled = 0
|
||||||
call s:clear_signs(s:current_file())
|
call s:clear_signs(s:current_file())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! EnableGitGutter()
|
function! EnableGitGutter()
|
||||||
let s:gitgutter_enabled = 1
|
let g:gitgutter_enabled = 1
|
||||||
call GitGutter()
|
call GitGutter()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ToggleGitGutter()
|
function! ToggleGitGutter()
|
||||||
if s:is_gitgutter_enabled()
|
if g:gitgutter_enabled
|
||||||
call DisableGitGutter()
|
call DisableGitGutter()
|
||||||
else
|
else
|
||||||
call EnableGitGutter()
|
call EnableGitGutter()
|
||||||
|
|||||||
Reference in New Issue
Block a user