Ensure that all buffers are processed at startup.

When opening vim with multiple files, e.g. via `vim -o file1 file2`, Vim
fires a `BufEnter` event for each file.  However the effective buffer
number (`<abuf>`) is always 1, instead of being each buffer's number in
turn, so we end up processing the first buffer n times instead of each
of n buffers once.

This commit is a brute force workaround to ensure all buffers are
processed if there is more than one.

Closes #428.
This commit is contained in:
Andy Stewart
2017-07-26 09:36:29 +01:00
parent dcac1f74ee
commit c92f61acdc

View File

@@ -208,6 +208,11 @@ augroup gitgutter
autocmd TabEnter * call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1)
" Ensure that all buffers are processed when opening vim with multiple files, e.g.:
"
" vim -o file1 file2
autocmd VimEnter * if winnr() != winnr('$') | :GitGutterAll | endif
if !has('gui_win32')
autocmd FocusGained * call gitgutter#all()
endif