@@ -13,12 +13,12 @@ copy plugin/auto-pairs.vim to ~/.vim/plugin
13
13
Features
14
14
--------
15
15
* Insert in pair
16
-
16
+
17
17
input: [
18
18
output: [|]
19
19
20
20
* Delete in pair
21
-
21
+
22
22
input: foo[<BS>
23
23
output: foo
24
24
@@ -40,6 +40,11 @@ Features
40
40
input: '|' (press <SPACE> at |)
41
41
output: ' |'
42
42
43
+ * Skip ' when inside a word
44
+
45
+ input: foo| (press ' at |)
46
+ output: foo'
47
+
43
48
* Skip closed bracket.
44
49
45
50
input: []
@@ -56,8 +61,8 @@ Features
56
61
output: ('hello')
57
62
58
63
* Quick jump to closed pair.
59
-
60
- input:
64
+
65
+ input:
61
66
{
62
67
something;|
63
68
}
@@ -69,26 +74,82 @@ Features
69
74
70
75
}|
71
76
77
+ * Support ``` ''' and """
78
+
79
+ input:
80
+ '''
81
+
82
+ output:
83
+ '''
84
+
85
+ * Fly Mode
86
+
87
+ input: if(a[3)
88
+ output: if(a[3])| (In Fly Mode)
89
+ output: if(a[3)]) (Without Fly Mode)
90
+
91
+ input:
92
+ {
93
+ hello();|
94
+ world();
95
+ }
96
+
97
+ (press } at |)
98
+
99
+ output:
100
+ {
101
+ hello();
102
+ world();
103
+ }|
104
+
105
+ (then press <M-b> at | to do backinsert)
106
+ output:
107
+ {
108
+ hello();}|
109
+ world();
110
+ }
111
+
112
+ See Fly Mode section for details
113
+
114
+ Fly Mode
115
+ --------
116
+ Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]"
117
+
118
+ If jumps in mistake, could use AutoPairsBackInsert(Default Key: <M-b>) to jump back and insert closed pair.
119
+
120
+ the most situation maybe want to insert single closed pair in the string, eg ")"
121
+
122
+ Fly Mode is DISABLED by default.
123
+
124
+ add **let g:AutoPairsFlyMode = 1** .vimrc to turn it on
125
+
126
+ Default Options:
127
+
128
+ let g:AutoPairsFlyMode = 0
129
+ let g:AutoPairsShortcutBackInsert = '<M-b>'
130
+
72
131
Shortcuts
73
132
---------
74
133
75
134
System Shortcuts:
76
135
<CR> : Insert new indented line after return if cursor in blank brackets or quotes.
77
136
<BS> : Delete brackets in pair
78
- <M-p> : Toggle Autopairs
79
- <M-e> : Fast Wrap
137
+ <M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle)
138
+ <M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap)
139
+ <M-n> : Jump to next closed pair (g:AutoPairsShortcutJump)
140
+ <M-b> : BackInsert
80
141
81
- Optional Shortcuts:
82
- could be turn off by let g:AutoPairsShortcuts = 0
83
- <M-n> jump to next closed bracket.
84
- <M-a> jump to end of line.
85
- <M-o> jump to newline with indented .
142
+ If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add
143
+
144
+ let g:AutoPairShortcutToggle = '<another key>'
145
+
146
+ to .vimrc, it the key is empty string '', then the shortcut will be disabled .
86
147
87
148
Options
88
149
-------
89
150
* g:AutoPairs
90
151
91
- Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"'}
152
+ Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`' }
92
153
93
154
* g:AutoPairsShortcutToggle
94
155
@@ -97,21 +158,18 @@ Options
97
158
The shortcut to toggle autopairs.
98
159
99
160
* g:AutoPairsShortcutFastWrap
100
-
161
+
101
162
Default: '<M-e>'
102
163
103
164
Fast wrap the word. all pairs will be consider as a block (include <>).
104
165
(|)'hello' after fast wrap at |, the word will be ('hello')
105
166
(|)<hello> after fast wrap at |, the word will be (<hello>)
106
167
107
- * g:AutoPairsShortcuts
168
+ * g:AutoPairsShortcutJump
108
169
109
- Default: 1
170
+ Default: '<M-n>'
110
171
111
- imap 3 shortcuts
112
- <M-n> jump to next closed bracket.
113
- <M-a> jump to end of line.
114
- <M-o> jump to newline with indented.
172
+ Jump to the next closed pair
115
173
116
174
* g:AutoPairsMapBS
117
175
@@ -140,9 +198,22 @@ Options
140
198
Map <space> to insert a space after the opening character and before the closing one.
141
199
execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>'
142
200
201
+ * g:AutoPairsFlyMode
202
+
203
+ Default : 0
204
+
205
+ set it to 1 to enable FlyMode.
206
+ see FlyMode section for details.
207
+
208
+ * g:AutoPairsShortcutBackInsert
209
+
210
+ Default : <M-b>
211
+
212
+ Work with FlyMode, insert the key at the Fly Mode jumped postion
213
+
143
214
TroubleShooting
144
215
---------------
145
- The script will remap keys ([{'"}]) <BS>,
216
+ The script will remap keys ([{'"}]) <BS>,
146
217
If auto pairs cannot work, use :imap ( to check if the map is corrected.
147
218
The correct map should be <C-R>=AutoPairsInsert("\(")<CR>
148
219
Or the plugin conflict with some other plugins.
@@ -158,3 +229,4 @@ TroubleShooting
158
229
2. use Alt-P to turn off the plugin.
159
230
160
231
3. use DEL or <C-O>x to delete the character insert by plugin.
232
+
0 commit comments