mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Speed up work done on FocusGained.
When vim-gitgutter is configured to update on `BufEnter`, which is the default, we only need to update visible buffers on `FocusGained`. Other buffers will be updated as and when the user enters them.
This commit is contained in:
@@ -112,6 +112,14 @@ function! s:buffers()
|
||||
return filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
||||
endfunction
|
||||
|
||||
function! s:visible_buffers()
|
||||
let visible = []
|
||||
for i in range(tabpagenr('$'))
|
||||
call extend(visible, tabpagebuflist(i + 1))
|
||||
endfor
|
||||
return visible
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
" Highlights and signs {{{
|
||||
@@ -388,7 +396,8 @@ endfunction
|
||||
" Public interface {{{
|
||||
|
||||
function! GitGutterAll()
|
||||
for buffer_id in s:buffers()
|
||||
let buffer_ids = g:gitgutter_on_bufenter ? s:visible_buffers() : s:buffers()
|
||||
for buffer_id in buffer_ids
|
||||
call GitGutter(fnamemodify(bufname(buffer_id), ':p'))
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user