From c92f61acdc1841292b539a8515a88ed811eafa3f Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 26 Jul 2017 09:36:29 +0100 Subject: [PATCH] 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 (``) 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. --- plugin/gitgutter.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 11a5adf..19a8df7 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -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