diff options
-rw-r--r-- | autoload/insert_cancel.vim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/autoload/insert_cancel.vim b/autoload/insert_cancel.vim index afc8c8b..74af060 100644 --- a/autoload/insert_cancel.vim +++ b/autoload/insert_cancel.vim @@ -1,6 +1,6 @@ " On entering insert mode, reset the changed flag and check for a new round of " changes since insert mode was opened -function! insert_cancel#Enter() +function! insert_cancel#Enter() abort let b:insert_cancel_changed = 0 call insert_cancel#Check() endfunction @@ -8,14 +8,14 @@ endfunction " On leaving insert mode, whether normally or via <Plug>(InsertCancel), check " if changenr() exceeds the last time we cached it, and flag that a change has " taken place if it did -function! insert_cancel#Check() +function! insert_cancel#Check() abort if changenr() > b:insert_cancel_changenr let b:insert_cancel_changed = 1 endif endfunction " On cancelling insert mode, if we think we made a change, undo it -function! insert_cancel#Cancel() +function! insert_cancel#Cancel() abort if get(b:, 'insert_cancel_changed', 0) silent undo endif |