diff options
Diffstat (limited to 'autoload/insert_cancel.vim')
-rw-r--r-- | autoload/insert_cancel.vim | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/autoload/insert_cancel.vim b/autoload/insert_cancel.vim deleted file mode 100644 index 74af060..0000000 --- a/autoload/insert_cancel.vim +++ /dev/null @@ -1,22 +0,0 @@ -" 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() abort - let b:insert_cancel_changed = 0 - call insert_cancel#Check() -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() 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() abort - if get(b:, 'insert_cancel_changed', 0) - silent undo - endif -endfunction |