From 83eb5377bedb024ada8d1259628650ba1624b77e Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 28 Aug 2019 09:07:07 +0100 Subject: [PATCH] Fix FileChangedShellPost handler on terminal vim. It seems to be necessary to delay the update by 1 tick. See #607. --- plugin/gitgutter.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 33a07a1..40124e3 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -220,7 +220,11 @@ augroup gitgutter autocmd BufEnter * call s:on_bufenter() autocmd CursorHold,CursorHoldI * call gitgutter#process_buffer(bufnr(''), 0) - autocmd FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 1) + if exists('*timer_start') && has('lambda') + autocmd FileChangedShellPost * call timer_start(1, {-> gitgutter#process_buffer(bufnr(''), 1)}) + else + autocmd FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 1) + endif " Ensure that all buffers are processed when opening vim with multiple files, e.g.: "