mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Conditionally define s:vimdiff
This optimizes it a bit since the `exists()` is not called always.
This commit is contained in:
committed by
Andy Stewart
parent
18f6d0ffe1
commit
4931dd1a82
@@ -195,23 +195,25 @@ endfunction
|
||||
|
||||
" Returns 1 if any of the given buffer's windows has the `&diff` option set,
|
||||
" or 0 otherwise.
|
||||
function! s:vimdiff(bufnr)
|
||||
if exists('*win_findbuf')
|
||||
if exists('*win_findbuf')
|
||||
function! s:vimdiff(bufnr) abort
|
||||
for winid in win_findbuf(a:bufnr)
|
||||
if getwinvar(winid, '&diff')
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
else
|
||||
endfunction
|
||||
else
|
||||
function! s:vimdiff(bufnr) abort
|
||||
for winnr in range(1, winnr('$'))
|
||||
if winbufnr(winnr) == a:bufnr && getwinvar(winnr, '&diff')
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:windows()
|
||||
return has('win64') || has('win32') || has('win32unix') || has('win16')
|
||||
|
||||
Reference in New Issue
Block a user