Skip to content

Commit 7b9f5f6

Browse files
Shane-XB-Qianjamessan
authored andcommitted
Refine 'refresh_windows' and Fix 'start_all'
* refine 'refresh_windows' from #364 - looks should try to refresh all active buf in cur tab -but not just cur one - looks better use common func -but not dup code again - and modify sy#buffer_is_active() as per jamessan's advice * fix 'start_all' - looks missed '$' in bufnr()
1 parent b2a0450 commit 7b9f5f6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

autoload/sy.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ endfunction
8888

8989
" #start_all {{{1
9090
function! sy#start_all() abort
91-
for bufnr in range(1, bufnr(''))
91+
for bufnr in range(1, bufnr("$"))
9292
call sy#start({'bufnr': bufnr})
9393
endfor
9494
let g:signify_disable_by_default = 0
@@ -105,8 +105,9 @@ function! sy#stop_all() abort
105105
endfunction
106106

107107
" #buffer_is_active {{{1
108-
function! sy#buffer_is_active()
109-
return !empty(getbufvar(bufnr(''), 'sy'))
108+
function! sy#buffer_is_active(...)
109+
let bufnr = a:0 ? a:1 : bufnr('')
110+
return !empty(getbufvar(bufnr, 'sy'))
110111
endfunction
111112

112113
" #verbose {{{1

autoload/sy/util.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ endfunction
2424

2525
" #refresh_windows {{{1
2626
function! sy#util#refresh_windows() abort
27-
" return if signify is not active
28-
if empty(getbufvar(bufnr(''), 'sy'))
29-
return
30-
endif
3127
if exists('*win_getid')
3228
let winid = win_getid()
3329
else
@@ -36,7 +32,9 @@ function! sy#util#refresh_windows() abort
3632

3733
if !get(g:, 'signify_cmdwin_active')
3834
for bufnr in tabpagebuflist()
39-
call sy#start({'bufnr': bufnr})
35+
if sy#buffer_is_active(bufnr)
36+
call sy#start({'bufnr': bufnr})
37+
endif
4038
endfor
4139
endif
4240

0 commit comments

Comments
 (0)