diff --git a/autoload/sy.vim b/autoload/sy.vim index c3e1962..756397d 100644 --- a/autoload/sy.vim +++ b/autoload/sy.vim @@ -96,7 +96,8 @@ endfunction " Function: #stop {{{1 function! sy#stop(bnum) abort - if !exists('b:sy') + let bvars = getbufvar(a:bnum, '') + if empty(bvars) || !has_key(bvars, 'sy') return endif diff --git a/autoload/sy/sign.vim b/autoload/sy/sign.vim index 0815c64..07412c4 100644 --- a/autoload/sy/sign.vim +++ b/autoload/sy/sign.vim @@ -42,16 +42,18 @@ endfunction " Function: #remove_all {{{1 function! sy#sign#remove_all(bnum) abort + let sy = getbufvar(a:bnum, 'sy') + if g:signify_sign_overwrite - execute 'sign unplace * buffer='. b:sy.buffer + execute 'sign unplace * buffer='. sy.buffer else - for hunk in b:sy.hunks + for hunk in sy.hunks for id in hunk.ids execute 'sign unplace' id endfor endfor endif - let b:sy.hunks = [] - let b:sy.stats = [0, 0, 0] + let sy.hunks = [] + let sy.stats = [0, 0, 0] endfunction diff --git a/plugin/signify.vim b/plugin/signify.vim index 2d80ab0..a0d13e3 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -14,8 +14,7 @@ augroup signify autocmd VimEnter * call sy#highlight#setup() autocmd BufRead,BufEnter * let b:sy_path = resolve(expand(':p')) autocmd BufRead,BufWritePost * call sy#start(b:sy_path) - - autocmd BufDelete * call sy#stop(expand('')) + autocmd BufDelete * call sy#stop(expand('')) if get(g:, 'signify_update_on_bufenter') autocmd BufEnter * nested