aboutsummaryrefslogtreecommitdiff
path: root/doc/insert_cancel.txt
blob: b7888b39dce70221eaf42e67dd91ff07922eeed3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
*insert_cancel.txt*	For Vim version 6.0	Last change: 2018 July 11

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.

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|.

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:
>
	imap <C-C> <Plug>(InsertCancel)

AUTHOR					*insert_cancel-author*

Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.

LICENSE					*insert_cancel-license*

Licensed for distribution under the same terms as Vim itself (see |license|).

 vim:tw=78:ts=8:ft=help:norl: