From 64bb161497813f8c84007de6f6983010516e69c7 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 13 Apr 2017 02:01:51 +0800 Subject: [PATCH] Fix not updating 'b:AutoCenter_MaxChangeNr' when a change in Insert mode or Replace mode is done. --- autoload/AutoCenter.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/AutoCenter.vim b/autoload/AutoCenter.vim index 35970ba..8ddc8da 100644 --- a/autoload/AutoCenter.vim +++ b/autoload/AutoCenter.vim @@ -20,7 +20,7 @@ function! AutoCenter#On() "{{{ " text changes. So we don't center text in these cases. autocmd TextChanged,TextChangedI * \ if !s:isUndoRedo() | call s:center() | endif - autocmd BufEnter * call s:upMaxChangeNr() + autocmd BufEnter,InsertLeave * call s:upMaxChangeNr() augroup END call s:upMaxChangeNr() call s:saveMapping() " Save mappings for later restoring. @@ -56,7 +56,7 @@ function! s:center() "{{{ call cursor('.', l:curpos + indent('.')) " An ongoing change in Insert mode or Replace mode is not taken as a new " change if updating the 'b:AutoCenter_MaxChangeNr' during this time. To avoid - " this, wait until it is done. + " this, wait until it is done, i.e., the autocmd event 'InsertLeave' occurs. if mode() !~ '^[iR]' call s:upMaxChangeNr() endif