From 769048e90ba81136bbf59e786f952b29bf071fea Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 14 Jul 2018 01:45:18 +1200 Subject: Rewrite documentation --- README.md | 8 ++++---- doc/insert_cancel.txt | 36 ++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index e767d80..0bfb346 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ insert\_cancel.vim ================== -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 Ctrl-C in insert +mode. License ------- 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 u -< MAPPINGS *insert_cancel-mappings* *(InsertCancel)* -The single mapping target provided is |(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 |(InsertCancel)|. There is no +default key mapping; you should define one yourself in your |vimrc|. For +example: > imap (InsertCancel) - +< AUTHOR *insert_cancel-author* Written and maintained by Tom Ryder . -- cgit v1.2.3