From dea49a1967b69f50ea7573ec81243fd67d7b7f26 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 3 Feb 2017 01:49:46 +0100 Subject: [PATCH] Fix toggling when g:signify_disable_by_default is set --- autoload/sy.vim | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/autoload/sy.vim b/autoload/sy.vim index 3bd9ea8..c07901d 100644 --- a/autoload/sy.vim +++ b/autoload/sy.vim @@ -52,8 +52,14 @@ function! sy#start() abort call sy#verbose('Inactive buffer.') return elseif b:sy.vcs == 'unknown' - call sy#verbose('No VCS found. Disabling.') - call sy#disable() + if get(b:sy, 'retry') + let b:sy.retry = 0 + call sy#verbose('Redetecting VCS.') + call sy#repo#detect(1) + else + call sy#verbose('No VCS found. Disabling.') + call sy#disable() + endif else call sy#verbose('Updating signs.') call sy#repo#get_diff_start(b:sy.vcs, 0) @@ -101,8 +107,16 @@ endfunction " Function: #enable {{{1 function! sy#enable() abort - silent! unlet b:sy b:sy_info - call sy#start() + if !exists('b:sy') + call sy#start() + return + endif + + if !b:sy.active + let b:sy.active = 1 + let b:sy.retry = 1 + call sy#start() + endif endfunction " Function: #disable {{{1