-
Notifications
You must be signed in to change notification settings - Fork 23
/
exchange.txt
91 lines (61 loc) · 3.52 KB
/
exchange.txt
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
*exchange.txt* Plugin to define a text exchange operator
Author: Tom McDonald <http://tommcdo.com>
License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
INTRODUCTION *exchange*
This plugin provides |operators| for exchanging text in two places. The main
operator is |cx|, which is used in pairs. Each time it is used, it defines a
region of text to be exchanged; on the second use, the two defined regions are
exchanged. If one region is fully contained within the other, it replaces the
containing region.
MAPPINGS *exchange-mappings*
*cx* *exchange-define*
cx{motion} Used in pairs.
FIRST USE: define the first region of text to be
exchanged. Any valid {motion} can be used.
SECOND USE: define the second region of text and
perform the exchange.
Note: If a region was defined accidentally, it can
be cleared with |cxc|
*cxx* *exchange-define-line*
cxx Like |cx|, but for the current line. |linewise|
*cxc* *exchange-clear*
cxc Clear any defined region of text (previously defined
by a |cx| command)
*v_X* *exchange-visual*
{Visual}X Can be used in |visual-mode|.
COMMANDS *exchange-commands*
*exchange-:ExchangeClear*
:ExchangeClear Ex-command version of |cxc|.
EXAMPLES *exchange-examples*
In the text below, we will exchange everything inside the parentheses with
everything inside the double quotes.
Tom "a Vim plugin developer" McDonald (The Dev)
First, place your cursor somewhere inside the quoted string and type `cxi"`.
Then move your cursor to somewhere inside the parentheses and type `cxi)`. The
text will the be changed to:
Tom "The Dev" McDonald (a Vim plugin developer)
It should be noted that I don't actually go by that nickname.
SETTINGS *exchange-settings*
To change the default mappings, simply provide your own mappings to the
commands below. The default mappings are as follows:
nmap cx <Plug>(Exchange)
xmap X <Plug>(Exchange)
nmap cxc <Plug>(ExchangeClear)
nmap cxx <Plug>(ExchangeLine)
For example, to change the mapping for exchanging a line, use the following:
nmap cX <Plug>(ExchangeLine)
This will use the mapping `cX`, and the default `cxx` will not be mapped.
*g:exchange_no_mappings*
g:exchange_no_mappings ~
If this variable is defined, the default mappings will not be created.
*g:exchange_indent*
g:exchange_indent ~
If this variable is defined and non-zero, linewise exchanges will swap
indents. Alternatively, setting the option to '==' will re-indent the
exchanged text with |==|. This behavior can be configured per buffer by
setting b:exchange_indent.
ISSUES AND TODO *exchange-issues*
*exchange-todo*
See https://github.com/tommcdo/vim-exchange/issues for bugs and issues.
vim:tw=78:ts=8:ft=help:norl: