diff options
Diffstat (limited to 'doc/insert_cancel.txt')
-rw-r--r-- | doc/insert_cancel.txt | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/doc/insert_cancel.txt b/doc/insert_cancel.txt index b7888b3..4adb82c 100644 --- a/doc/insert_cancel.txt +++ b/doc/insert_cancel.txt @@ -1,35 +1,31 @@ -*insert_cancel.txt* For Vim version 6.0 Last change: 2018 July 11 +*insert_cancel.txt* For Vim version 6.0 Last change: 2018 July 12 DESCRIPTION *insert_cancel* -This plugin provides a mapping target to cancel an insert operation, by -leaving insert mode normally and undoing a change if one was made by that -insert operation. It's intended as a target for |i_CTRL-C|, to make it do -something useful, and to fire |InsertLeave| afterwards where available. +This plugin provides a mapping target to cancel an insert operation. It leaves +insert mode normally, firing |InsertLeave|, and then runs |:undo| if the +buffer was changed by the insert. This is intended as a remap of |i_CTRL-C|. REQUIREMENTS *insert_cancel-requirements* -This plugin is only available if 'compatible' is not set. It works better on -newer versions of Vim. It works best if you have |autocmd| and at least -|version-7.0|, because it leans on |CursorMoved|. +This plugin only loads if 'compatible' is not set. It works best if you +have at least |vim7| with |autocmd|, because it leans on the |CursorMoved| +event. + +If you don't have |CursorMoved|, the |'[| and |']| marks are used to detect +changes instead. This still works for undoing insert additions, but it won't +restore text that was erased when insert mode was entered with |c| or |s| or +their variants, and it doesn't undo new unindented blank lines. -If you don't have |autocmd| and |version7|, all the plugin has to go on are -the |'[| and |']| marks. It still kind of works, but there are some big gaps; -it won't undo text that was erased when insert mode was entered with |c| or -|s| or its variants, and it also may not undo new blank lines. Even this is -still rather better than just the intuitive mapping: -> - imap <C-C> <Esc>u -< MAPPINGS *insert_cancel-mappings* *<Plug>(InsertCancel)* -The single mapping target provided is |<Plug>(InsertCancel)|, mappable in any -mode. There is no default key mapping to the target; you should define this -yourself in your |vimrc|. For example: +The single insert mode mapping target is |<Plug>(InsertCancel)|. There is no +default key mapping; you should define one yourself in your |vimrc|. For +example: > imap <C-C> <Plug>(InsertCancel) - +< AUTHOR *insert_cancel-author* Written and maintained by Tom Ryder <tom@sanctum.geek.nz>. |