]>
Commit | Line | Data |
---|---|---|
1 | *delimitMate.txt* Trying to keep those beasts at bay! v2.6 *delimitMate* | |
2 | ||
3 | ||
4 | ||
5 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
6 | MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMM MMMMMMMMMMMMMMMMMMMMM ~ | |
7 | MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMMMMMMMMMMMMMMMMMMM | |
8 | MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMM MMM M M MMMMMMMMMM MMMMMMMMM ~ | |
9 | MMMM MMM MMM MM MM M M MMM MM MM MM MM MMM MMM MMM MM | |
10 | MM MM M MM MMMMMM MMMMMMM MMM MMMMM MM M MMM MMM M M ~ | |
11 | M M MM MM MM MM M M MM MMM MMM MMMMM MMMMM MMM MMM M | |
12 | M M MM MMMMM MM MM M M MM MMM MMM MMMMM MMM MMM MMM MMMM ~ | |
13 | M M MM M MM MM MM M M MM MMM MMM MMMMM MM M MMM MMM M M | |
14 | MM MMM MMM MM MM M M MM MMM MM MMMMM MMM MMM MMM MM ~ | |
15 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
16 | ||
17 | ||
18 | ||
19 | ============================================================================== | |
20 | 0.- CONTENTS *delimitMate-contents* | |
21 | ||
22 | 1. Introduction____________________________|delimitMateIntro| | |
23 | 2. Customization___________________________|delimitMateOptions| | |
24 | 2.1 Options summary____________________|delimitMateOptionSummary| | |
25 | 2.2 Options details____________________|delimitMateOptionDetails| | |
26 | 3. Functionality___________________________|delimitMateFunctionality| | |
27 | 3.1 Automatic closing & exiting________|delimitMateAutoClose| | |
28 | 3.2 Expansion of space and CR__________|delimitMateExpansion| | |
29 | 3.3 Backspace__________________________|delimitMateBackspace| | |
30 | 3.4 Smart Quotes_______________________|delimitMateSmartQuotes| | |
31 | 3.5 Balancing matching pairs___________|delimitMateBalance| | |
32 | 3.6 FileType based configuration_______|delimitMateFileType| | |
33 | 3.7 Syntax awareness___________________|delimitMateSyntax| | |
34 | 4. Commands________________________________|delimitMateCommands| | |
35 | 5. Mappings________________________________|delimitMateMappings| | |
36 | 6. Functions_______________________________|delimitMateFunctions| | |
37 | 7. TODO list_______________________________|delimitMateTodo| | |
38 | 8. Maintainer______________________________|delimitMateMaintainer| | |
39 | 9. Credits_________________________________|delimitMateCredits| | |
40 | 10. History_________________________________|delimitMateHistory| | |
41 | ||
42 | ============================================================================== | |
43 | 1.- INTRODUCTION *delimitMateIntro* | |
44 | ||
45 | This plug-in provides automatic closing of quotes, parenthesis, brackets, | |
46 | etc.; besides some other related features that should make your time in insert | |
47 | mode a little bit easier. | |
48 | ||
49 | Most of the features can be modified or disabled permanently, using global | |
50 | variables, or on a FileType basis, using autocommands. With a couple of | |
51 | exceptions and limitations, this features don't brake undo, redo or history. | |
52 | ||
53 | NOTE 1: If you have any trouble with this plugin, please run |:DelimitMateTest| | |
54 | in a new buffer to see what is not working. | |
55 | ||
56 | NOTE 2: |'timeout'| needs to be set when working in the terminal, otherwise you | |
57 | might find weird behaviour with mappings including <Esc> or arrow keys. | |
58 | ||
59 | NOTE 3: Abbreiations set with |:iabbrev| will not be expanded by delimiters | |
60 | used on delimitMate, you should use <C-]> (read |i_CTRL-]|) to expand them on | |
61 | the go. | |
62 | ||
63 | ============================================================================== | |
64 | 2. CUSTOMIZATION *delimitMateOptions* | |
65 | ||
66 | You can create your own mappings for some features using the global functions. | |
67 | Read |DelimitMateFunctions| for more info. | |
68 | ||
69 | ------------------------------------------------------------------------------ | |
70 | 2.1 OPTIONS SUMMARY *delimitMateOptionSummary* | |
71 | ||
72 | The behaviour of this script can be customized setting the following options | |
73 | in your vimrc file. You can use local options to set the configuration for | |
74 | specific file types, see |delimitMateOptionDetails| for examples. | |
75 | ||
76 | |'loaded_delimitMate'| Turns off the script. | |
77 | ||
78 | |'delimitMate_autoclose'| Tells delimitMate whether to automagically | |
79 | insert the closing delimiter. | |
80 | ||
81 | |'delimitMate_matchpairs'| Tells delimitMate which characters are | |
82 | matching pairs. | |
83 | ||
84 | |'delimitMate_quotes'| Tells delimitMate which quotes should be | |
85 | used. | |
86 | ||
87 | |'delimitMate_nesting_quotes'| Tells delimitMate which quotes should be | |
88 | allowed to be nested. | |
89 | ||
90 | |'delimitMate_expand_cr'| Turns on/off the expansion of <CR>. | |
91 | ||
92 | |'delimitMate_expand_space'| Turns on/off the expansion of <Space>. | |
93 | ||
94 | |'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature. | |
95 | ||
96 | |'delimitMate_smart_matchpairs'| Turns on/off the "smart matchpairs" feature. | |
97 | ||
98 | |'delimitMate_balance_matchpairs'|Turns on/off the "balance matching pairs" | |
99 | feature. | |
100 | ||
101 | |'delimitMate_excluded_regions'| Turns off the script for the given regions or | |
102 | syntax group names. | |
103 | ||
104 | |'delimitMate_excluded_ft'| Turns off the script for the given file types. | |
105 | ||
106 | |'delimitMate_apostrophes'| Tells delimitMate how it should "fix" | |
107 | balancing of single quotes when used as | |
108 | apostrophes. NOTE: Not needed any more, kept | |
109 | for compatibility with older versions. | |
110 | ||
111 | ------------------------------------------------------------------------------ | |
112 | 2.2 OPTIONS DETAILS *delimitMateOptionDetails* | |
113 | ||
114 | Add the shown lines to your vimrc file in order to set the below options. | |
115 | Buffer variables take precedence over global ones and can be used along with | |
116 | autocmd to modify delimitMate's behavior for specific file types, read more in | |
117 | |delimitMateFileType|. | |
118 | ||
119 | Note: Use buffer variables only to set options for specific file types using | |
120 | :autocmd, use global variables to set options for every buffer. Read more in | |
121 | |g:var| and |b:var|. | |
122 | ||
123 | ------------------------------------------------------------------------------ | |
124 | *'loaded_delimitMate'* | |
125 | *'b:loaded_delimitMate'* | |
126 | This option prevents delimitMate from loading. | |
127 | e.g.: > | |
128 | let loaded_delimitMate = 1 | |
129 | au FileType mail let b:loaded_delimitMate = 1 | |
130 | < | |
131 | ------------------------------------------------------------------------------ | |
132 | *'delimitMate_autoclose'* | |
133 | *'b:delimitMate_autoclose'* | |
134 | Values: 0 or 1. ~ | |
135 | Default: 1 ~ | |
136 | ||
137 | If this option is set to 0, delimitMate will not add a closing delimiter | |
138 | automagically. See |delimitMateAutoClose| for details. | |
139 | e.g.: > | |
140 | let delimitMate_autoclose = 0 | |
141 | au FileType mail let b:delimitMate_autoclose = 0 | |
142 | < | |
143 | ------------------------------------------------------------------------------ | |
144 | *'delimitMate_matchpairs'* | |
145 | *'b:delimitMate_matchpairs'* | |
146 | Values: A string with |'matchpairs'| syntax, plus support for multi-byte~ | |
147 | characters.~ | |
148 | Default: &matchpairs ~ | |
149 | ||
150 | Use this option to tell delimitMate which characters should be considered | |
151 | matching pairs. Read |delimitMateAutoClose| for details. | |
152 | e.g: > | |
153 | let delimitMate_matchpairs = "(:),[:],{:},<:>" | |
154 | au FileType vim,html let b:delimitMate_matchpairs = "(:),[:],{:},<:>" | |
155 | < | |
156 | ------------------------------------------------------------------------------ | |
157 | *'delimitMate_quotes'* | |
158 | *'b:delimitMate_quotes'* | |
159 | Values: A string of characters separated by spaces. ~ | |
160 | Default: "\" ' `" ~ | |
161 | ||
162 | Use this option to tell delimitMate which characters should be considered as | |
163 | quotes. Read |delimitMateAutoClose| for details. | |
164 | e.g.: > | |
165 | let delimitMate_quotes = "\" ' ` *" | |
166 | au FileType html let b:delimitMate_quotes = "\" '" | |
167 | < | |
168 | ------------------------------------------------------------------------------ | |
169 | *'delimitMate_nesting_quotes'* | |
170 | *'b:delimitMate_nesting_quotes'* | |
171 | Values: A list of quotes. ~ | |
172 | Default: [] ~ | |
173 | ||
174 | Quotes listed here will not be able to jump out of the empty pair, thus | |
175 | allowing the autoclosed quotes to be nested. | |
176 | e.g.: > | |
177 | let delimitMate_nesting_quotes = ['"','`'] | |
178 | au FileType python let b:delimitMate_nesting_quotes = ['"'] | |
179 | < | |
180 | ------------------------------------------------------------------------------ | |
181 | *'delimitMate_expand_cr'* | |
182 | *'b:delimitMate_expand_cr'* | |
183 | Values: 1 or 0 ~ | |
184 | Default: 0 ~ | |
185 | ||
186 | This option turns on/off the expansion of <CR>. Read |delimitMateExpansion| | |
187 | for details. NOTE This feature requires that 'backspace' is either set to 2 or | |
188 | has "eol" and "start" as part of its value. | |
189 | e.g.: > | |
190 | let delimitMate_expand_cr = 1 | |
191 | au FileType mail let b:delimitMate_expand_cr = 1 | |
192 | < | |
193 | ------------------------------------------------------------------------------ | |
194 | *'delimitMate_expand_space'* | |
195 | *'b:delimitMate_expand_space'* | |
196 | Values: 1 or 0 ~ | |
197 | Default: 0 ~ | |
198 | This option turns on/off the expansion of <Space>. Read |delimitMateExpansion| | |
199 | for details. | |
200 | e.g.: > | |
201 | let delimitMate_expand_space = 1 | |
202 | au FileType tcl let b:delimitMate_expand_space = 1 | |
203 | < | |
204 | ------------------------------------------------------------------------------ | |
205 | *'delimitMate_smart_quotes'* | |
206 | *'b:delimitMate_smart_quotes'* | |
207 | Values: 1 or 0 ~ | |
208 | Default: 1 ~ | |
209 | ||
210 | This option turns on/off the smart quotes feature. Read | |
211 | |delimitMateSmartQuotes| for details. | |
212 | e.g.: > | |
213 | let delimitMate_smart_quotes = 0 | |
214 | au FileType tcl let b:delimitMate_smart_quotes = 1 | |
215 | < | |
216 | ------------------------------------------------------------------------------ | |
217 | *'delimitMate_smart_matchpairs'* | |
218 | *'b:delimitMate_smart_matchpairs'* | |
219 | Values: Regexp ~ | |
220 | Default: '^\%(\w\|\!\|£\|\$\|_\|["'']\s*\S\)' ~ | |
221 | ||
222 | This regex is matched against the text to the right of cursor, if it's not | |
223 | empty and there is a match delimitMate will not autoclose the pair. At the | |
224 | moment to match the text, an escaped bang (\!) in the regex will be replaced | |
225 | by the character being inserted, while an escaped number symbol (\#) will be | |
226 | replaced by the closing pair. | |
227 | e.g.: > | |
228 | let delimitMate_smart_matchpairs = '' | |
229 | au FileType tcl let b:delimitMate_smart_matchpairs = '^\%(\w\|\$\)' | |
230 | < | |
231 | ------------------------------------------------------------------------------ | |
232 | *'delimitMate_balance_matchpairs'* | |
233 | *'b:delimitMate_balance_matchpairs'* | |
234 | Values: 1 or 0 ~ | |
235 | Default: 0 ~ | |
236 | ||
237 | This option turns on/off the balancing of matching pairs. Read | |
238 | |delimitMateBalance| for details. | |
239 | e.g.: > | |
240 | let delimitMate_balance_matchpairs = 1 | |
241 | au FileType tcl let b:delimitMate_balance_matchpairs = 1 | |
242 | < | |
243 | ------------------------------------------------------------------------------ | |
244 | *'delimitMate_excluded_regions'* | |
245 | Values: A string of syntax group names names separated by single commas. ~ | |
246 | Default: Comment ~ | |
247 | ||
248 | This options turns delimitMate off for the listed regions, read |group-name| | |
249 | for more info about what is a region. | |
250 | e.g.: > | |
251 | let delimitMate_excluded_regions = "Comments,String" | |
252 | < | |
253 | ------------------------------------------------------------------------------ | |
254 | *'delimitMate_excluded_ft'* | |
255 | Values: A string of file type names separated by single commas. ~ | |
256 | Default: Empty. ~ | |
257 | ||
258 | This options turns delimitMate off for the listed file types, use this option | |
259 | only if you don't want any of the features it provides on those file types. | |
260 | e.g.: > | |
261 | let delimitMate_excluded_ft = "mail,txt" | |
262 | < | |
263 | ------------------------------------------------------------------------------ | |
264 | *'delimitMate_apostrophes'* | |
265 | Values: Strings separated by ":". ~ | |
266 | Default: No longer used. ~ | |
267 | ||
268 | NOTE: This feature is turned off by default, it's been kept for compatibility | |
269 | with older version, read |delimitMateSmartQuotes| for details. | |
270 | If auto-close is enabled, this option tells delimitMate how to try to fix the | |
271 | balancing of single quotes when used as apostrophes. The values of this option | |
272 | are strings of text where a single quote would be used as an apostrophe (e.g.: | |
273 | the "n't" of wouldn't or can't) separated by ":". Set it to an empty string to | |
274 | disable this feature. | |
275 | e.g.: > | |
276 | let delimitMate_apostrophes = "" | |
277 | au FileType tcl let delimitMate_apostrophes = "" | |
278 | < | |
279 | ============================================================================== | |
280 | 3. FUNCTIONALITY *delimitMateFunctionality* | |
281 | ||
282 | ------------------------------------------------------------------------------ | |
283 | 3.1 AUTOMATIC CLOSING AND EXITING *delimitMateAutoClose* | |
284 | ||
285 | With automatic closing enabled, if an opening delimiter is inserted the plugin | |
286 | inserts the closing delimiter and places the cursor between the pair. With | |
287 | automatic closing disabled, no closing delimiters is inserted by delimitMate, | |
288 | but when a pair of delimiters is typed, the cursor is placed in the middle. | |
289 | ||
290 | When the cursor is inside an empty pair or located next to the left of a | |
291 | closing delimiter, the cursor is placed outside the pair to the right of the | |
292 | closing delimiter. | |
293 | ||
294 | When |'delimitMate_smart_matchpairs'| is not empty and it matches the text to | |
295 | the right of the cursor, delimitMate will not automatically insert the closing | |
296 | pair. | |
297 | ||
298 | Unless |'delimitMate_matchpairs'| or |'delimitMate_quotes'| are set, this | |
299 | script uses the values in '&matchpairs' to identify the pairs, and ", ' and ` | |
300 | for quotes respectively. | |
301 | ||
302 | <S-Tab> will jump over a single closing delimiter or quote, <C-G>g will jump | |
303 | over contiguous delimiters and/or quotes. | |
304 | ||
305 | The following table shows the behaviour, this applies to quotes too (the final | |
306 | position of the cursor is represented by a "|"): | |
307 | ||
308 | With auto-close: > | |
309 | Type | You get | |
310 | ======================= | |
311 | ( | (|) | |
312 | –––––––––––|––––––––––– | |
313 | () | ()| | |
314 | –––––––––––|––––––––––– | |
315 | (<S-Tab> | ()| | |
316 | –––––––––––|––––––––––– | |
317 | {("<C-G>g | {("")}| | |
318 | < | |
319 | Without auto-close: > | |
320 | ||
321 | Type | You get | |
322 | ========================= | |
323 | () | (|) | |
324 | –––––––––-----|–––––––––– | |
325 | ()) | ()| | |
326 | –––––––––-----|–––––––––– | |
327 | ()<S-Tab> | ()| | |
328 | ––––––––––––––|––––––––––– | |
329 | {}()""<C-G>g | {("")}| | |
330 | < | |
331 | NOTE: Abbreviations will not be expanded by delimiters used on delimitMate, | |
332 | you should use <C-]> (read |i_CTRL-]|) to expand them on the go. | |
333 | ||
334 | ------------------------------------------------------------------------------ | |
335 | 3.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion* | |
336 | ||
337 | When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be | |
338 | expanded, see |'delimitMate_expand_space'| and | |
339 | |'delimitMate_expand_cr'|: | |
340 | ||
341 | Expand <Space> to: > | |
342 | ||
343 | <Space><Space><Left> | You get | |
344 | ==================================== | |
345 | (|) | ( | ) | |
346 | < | |
347 | Expand <CR> to: > | |
348 | ||
349 | <CR><CR><Up> | You get | |
350 | ============================ | |
351 | (|) | ( | |
352 | | | | |
353 | | ) | |
354 | < | |
355 | ||
356 | NOTE that the expansion of <CR> will brake the redo command. | |
357 | ||
358 | Since <Space> and <CR> are used everywhere, I have made the functions involved | |
359 | in expansions global, so they can be used to make custom mappings. Read | |
360 | |delimitMateFunctions| for more details. | |
361 | ||
362 | ------------------------------------------------------------------------------ | |
363 | 3.3 BACKSPACE *delimitMateBackspace* | |
364 | ||
365 | If you press backspace inside an empty pair, both delimiters are deleted. When | |
366 | expansions are enabled, <BS> will also delete the expansions. NOTE that | |
367 | deleting <CR> expansions will brake the redo command. | |
368 | ||
369 | If you type <S-BS> (shift + backspace) instead, only the closing delimiter | |
370 | will be deleted. NOTE that this will not usually work when using Vim from the | |
371 | terminal, see 'delimitMate#JumpAny()' below to see how to fix it. | |
372 | ||
373 | e.g. typing at the "|": > | |
374 | ||
375 | What | Before | After | |
376 | ============================================== | |
377 | <BS> | call expand(|) | call expand| | |
378 | ---------|-------------------|----------------- | |
379 | <BS> | call expand( | ) | call expand(|) | |
380 | ---------|-------------------|----------------- | |
381 | <BS> | call expand( | call expand(|) | |
382 | | | | | |
383 | | ) | | |
384 | ---------|-------------------|----------------- | |
385 | <S-BS> | call expand(|) | call expand(| | |
386 | < | |
387 | ||
388 | ------------------------------------------------------------------------------ | |
389 | 3.4 SMART QUOTES *delimitMateSmartQuotes* | |
390 | ||
391 | Only one quote will be inserted following a quote, a "\" or, following or | |
392 | preceding a keyword character. This should cover closing quotes after a | |
393 | string, opening quotes before a string, escaped quotes and apostrophes. Except | |
394 | for apostrophes, this feature can be disabled setting the option | |
395 | |'delimitMate_smart_quotes'| to 0. | |
396 | ||
397 | e.g. typing at the "|": > | |
398 | ||
399 | What | Before | After | |
400 | ======================================= | |
401 | " | Text | | Text "|" | |
402 | " | "String| | "String"| | |
403 | " | let i = "| | let i = "|" | |
404 | 'm | I| | I'm| | |
405 | < | |
406 | ------------------------------------------------------------------------------ | |
407 | 3.4 SMART MATCHPAIRS *delimitMateSmartMatchpairs* | |
408 | ||
409 | This is similar to "smart quotes", but applied to the characters in | |
410 | |'delimitMate_matchpairs'|. The difference is that delimitMate will not | |
411 | auto-close the pair when the regex matches the text on the right of the | |
412 | cursor. See |'delimitMate_smart_matchpairs'| for more details. | |
413 | ||
414 | ||
415 | e.g. typing at the "|": > | |
416 | ||
417 | What | Before | After | |
418 | ======================================= | |
419 | ( | function| | function(|) | |
420 | ( | |var | (|var | |
421 | < | |
422 | ------------------------------------------------------------------------------ | |
423 | 3.5 BALANCING MATCHING PAIRS *delimitMateBalance* | |
424 | ||
425 | When inserting an opening paren and |'delimitMate_balance_matchpairs'| is | |
426 | enabled, delimitMate will try to balance the closing pairs in the current | |
427 | line. | |
428 | ||
429 | e.g. typing at the "|": > | |
430 | ||
431 | What | Before | After | |
432 | ======================================= | |
433 | ( | | | (|) | |
434 | ( | |) | (|) | |
435 | (( | |) | ((|)) | |
436 | < | |
437 | ------------------------------------------------------------------------------ | |
438 | 3.6 FILE TYPE BASED CONFIGURATION *delimitMateFileType* | |
439 | ||
440 | delimitMate options can be set globally for all buffers using global | |
441 | ("regular") variables in your |vimrc| file. But |:autocmd| can be used to set | |
442 | options for specific file types (see |'filetype'|) using buffer variables in | |
443 | the following way: > | |
444 | ||
445 | au FileType mail,text let b:delimitMate_autoclose = 0 | |
446 | ^ ^ ^ ^ ^ | |
447 | | | | | | | |
448 | | | | | - Option value. | |
449 | | | | - Option name. | |
450 | | | - Buffer variable. | |
451 | | - File types for which the option will be set. | |
452 | - Don't forget to put this event. | |
453 | < | |
454 | NOTE that you should use buffer variables (|b:var|) only to set options with | |
455 | |:autocmd|, for global options use regular variables (|g:var|) in your vimrc. | |
456 | ||
457 | ------------------------------------------------------------------------------ | |
458 | 3.7 SYNTAX AWARENESS *delimitMateSyntax* | |
459 | ||
460 | The features of this plug-in might not be always helpful, comments and strings | |
461 | usualy don't need auto-completion. delimitMate monitors which region is being | |
462 | edited and if it detects that the cursor is in a comment it'll turn itself off | |
463 | until the cursor leaves the comment. The excluded regions can be set using the | |
464 | option |'delimitMate_excluded_regions'|. Read |group-name| for a list of | |
465 | regions or syntax group names. | |
466 | ||
467 | NOTE that this feature relies on a proper syntax file for the current file | |
468 | type, if the appropiate syntax file doesn't define a region, delimitMate won't | |
469 | know about it. | |
470 | ||
471 | ============================================================================== | |
472 | 4. COMMANDS *delimitMateCommands* | |
473 | ||
474 | ------------------------------------------------------------------------------ | |
475 | :DelimitMateReload *:DelimitMateReload* | |
476 | ||
477 | Re-sets all the mappings used for this script, use it if any option has been | |
478 | changed or if the filetype option hasn't been set yet. | |
479 | ||
480 | ------------------------------------------------------------------------------ | |
481 | :DelimitMateSwitch *:DelimitMateSwitch* | |
482 | ||
483 | Switches the plug-in on and off. | |
484 | ||
485 | ------------------------------------------------------------------------------ | |
486 | :DelimitMateTest *:DelimitMateTest* | |
487 | ||
488 | This command tests every mapping set-up for this script, useful for testing | |
489 | custom configurations. | |
490 | ||
491 | The following output corresponds to the default values, it will be different | |
492 | depending on your configuration. "Open & close:" represents the final result | |
493 | when the closing delimiter has been inserted, either manually or | |
494 | automatically, see |delimitMateExpansion|. "Delete:" typing backspace in an | |
495 | empty pair, see |delimitMateBackspace|. "Exit:" typing a closing delimiter | |
496 | inside a pair of delimiters, see |delimitMateAutoclose|. "Space:" the | |
497 | expansion, if any, of space, see |delimitMateExpansion|. "Visual-L", | |
498 | "Visual-R" and "Visual" shows visual wrapping, see | |
499 | |delimitMateVisualWrapping|. "Car return:" the expansion of car return, see | |
500 | |delimitMateExpansion|. The cursor's position at the end of every test is | |
501 | represented by an "|": > | |
502 | ||
503 | * AUTOCLOSE: | |
504 | Open & close: (|) | |
505 | Delete: | | |
506 | Exit: ()| | |
507 | Space: ( |) | |
508 | Visual-L: (v) | |
509 | Visual-R: (v) | |
510 | Car return: ( | |
511 | |) | |
512 | ||
513 | Open & close: {|} | |
514 | Delete: | | |
515 | Exit: {}| | |
516 | Space: { |} | |
517 | Visual-L: {v} | |
518 | Visual-R: {v} | |
519 | Car return: { | |
520 | |} | |
521 | ||
522 | Open & close: [|] | |
523 | Delete: | | |
524 | Exit: []| | |
525 | Space: [ |] | |
526 | Visual-L: [v] | |
527 | Visual-R: [v] | |
528 | Car return: [ | |
529 | |] | |
530 | ||
531 | Open & close: "|" | |
532 | Delete: | | |
533 | Exit: ""| | |
534 | Space: " |" | |
535 | Visual: "v" | |
536 | Car return: " | |
537 | |" | |
538 | ||
539 | Open & close: '|' | |
540 | Delete: | | |
541 | Exit: ''| | |
542 | Space: ' |' | |
543 | Visual: 'v' | |
544 | Car return: ' | |
545 | |' | |
546 | ||
547 | Open & close: `|` | |
548 | Delete: | | |
549 | Exit: ``| | |
550 | Space: ` |` | |
551 | Visual: `v` | |
552 | Car return: ` | |
553 | |` | |
554 | < | |
555 | ||
556 | ============================================================================== | |
557 | 5. MAPPINGS *delimitMateMappings* | |
558 | ||
559 | delimitMate doesn't override any existing map, so you may encounter that it | |
560 | doesn't work as expected because a mapping is missing. In that case, the | |
561 | conflicting mappings should be resolved by either disabling the conflicting | |
562 | mapping or creating a custom mappings. | |
563 | ||
564 | In order to make custom mappings easier and prevent overwritting existing | |
565 | ones, delimitMate uses the |<Plug>| + |hasmapto()| (|usr_41.txt|) construct | |
566 | for its mappings. | |
567 | ||
568 | These are the default mappings: | |
569 | ||
570 | <BS> is mapped to <Plug>delimitMateBS | |
571 | <S-BS> is mapped to <Plug>delimitMateS-BS | |
572 | <S-Tab> is mapped to <Plug>delimitMateS-Tab | |
573 | <C-G>g is mapped to <Plug>delimitMateJumpMany | |
574 | <Del> is mapped to <Plug>delimitMateDel | |
575 | <Esc> is mapped to <Plug>delimitMateEsc | |
576 | <Left> is mapped to <Plug>delimitMateLeft | |
577 | <Right> is mapped to <Plug>delimitMateRight | |
578 | <Home> is mapped to <Plug>delimitMateHome | |
579 | <End> is mapped to <Plug>delimitMateEnd | |
580 | <Up> is mapped to <Plug>delimitMateUp | |
581 | <Down> is mapped to <Plug>delimitMateDown | |
582 | <PageUp> is mapped to <Plug>delimitMatePageUp | |
583 | <PageDown> is mapped to <Plug>delimitMatePageDown | |
584 | <S-Down> is mapped to <Plug>delimitMateS-Down | |
585 | <S-Up> is mapped to <Plug>delimitMateS-Up | |
586 | <LeftMouse> is mapped to <Plug>delimitMateMLeftMouse | |
587 | <RightMouse> is mapped to <Plug>delimitMateMRightMouse | |
588 | ||
589 | The rest of the mappings correspond to parens, quotes, CR, Space, etc. and they | |
590 | depend on the values of the delimitMate options, they have the following form: | |
591 | ||
592 | <Plug>delimitMate + char | |
593 | ||
594 | e.g.: for "(": | |
595 | ||
596 | ( is mapped to <Plug>delimitMate( | |
597 | ||
598 | e.g.: If you have <CR> expansion enabled, you might want to skip it on pop-up | |
599 | menus: | |
600 | ||
601 | imap <expr> <CR> pumvisible() ? | |
602 | \"\<c-y>" : | |
603 | \ "<Plug>delimitMateCR" | |
604 | ||
605 | ||
606 | ============================================================================== | |
607 | 6. FUNCTIONS *delimitMateFunctions* | |
608 | ||
609 | ------------------------------------------------------------------------------ | |
610 | delimitMate#WithinEmptyPair() *delimitMate#WithinEmptyPair()* | |
611 | ||
612 | Returns 1 if the cursor is inside an empty pair, 0 otherwise. | |
613 | e.g.: > | |
614 | ||
615 | inoremap <expr> <CR> delimitMate#WithinEmptyPair() ? | |
616 | \ "\<C-R>=delimitMate#ExpandReturn()\<CR>" : | |
617 | \ "external_mapping" | |
618 | < | |
619 | ||
620 | ------------------------------------------------------------------------------ | |
621 | delimitMate#ShouldJump() *delimitMate#ShouldJump()* | |
622 | ||
623 | Returns 1 if there is a closing delimiter or a quote to the right of the | |
624 | cursor, 0 otherwise. | |
625 | ||
626 | ------------------------------------------------------------------------------ | |
627 | delimitMate#JumpAny(key) *delimitMate#JumpAny()* | |
628 | ||
629 | This function returns a mapping that will make the cursor jump to the right | |
630 | when delimitMate#ShouldJump() returns 1, returns the argument "key" otherwise. | |
631 | e.g.: You can use this to create your own mapping to jump over any delimiter. | |
632 | > | |
633 | inoremap <C-Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR> | |
634 | < | |
635 | ||
636 | ============================================================================== | |
637 | 7. TODO LIST *delimitMateTodo* | |
638 | ||
639 | - Automatic set-up by file type. | |
640 | - Make block-wise visual wrapping work on un-even regions. | |
641 | ||
642 | ============================================================================== | |
643 | 8. MAINTAINER *delimitMateMaintainer* | |
644 | ||
645 | Hi there! My name is Israel Chauca F. and I can be reached at: | |
646 | mailto:israelchauca@gmail.com | |
647 | ||
648 | Feel free to send me any suggestions and/or comments about this plugin, I'll | |
649 | be very pleased to read them. | |
650 | ||
651 | ============================================================================== | |
652 | 9. CREDITS *delimitMateCredits* | |
653 | ||
654 | Contributors: ~ | |
655 | ||
656 | - Kim Silkebækken ~ | |
657 | Fixed mappings being echoed in the terminal. | |
658 | ||
659 | - Eric Van Dewoestine ~ | |
660 | Implemented smart matchpairs. | |
661 | ||
662 | Some of the code that makes this script was modified or just shamelessly | |
663 | copied from the following sources: | |
664 | ||
665 | - Ian McCracken ~ | |
666 | Post titled: Vim, Part II: Matching Pairs: | |
667 | http://concisionandconcinnity.blogspot.com/ | |
668 | ||
669 | - Aristotle Pagaltzis ~ | |
670 | From the comments on the previous blog post and from: | |
671 | http://gist.github.com/144619 | |
672 | ||
673 | - Karl Guertin ~ | |
674 | AutoClose: | |
675 | http://www.vim.org/scripts/script.php?script_id=1849 | |
676 | ||
677 | - Thiago Alves ~ | |
678 | AutoClose: | |
679 | http://www.vim.org/scripts/script.php?script_id=2009 | |
680 | ||
681 | - Edoardo Vacchi ~ | |
682 | ClosePairs: | |
683 | http://www.vim.org/scripts/script.php?script_id=2373 | |
684 | ||
685 | This script was inspired by the auto-completion of delimiters on TextMate. | |
686 | ||
687 | ============================================================================== | |
688 | 10. HISTORY *delimitMateHistory* | |
689 | ||
690 | Version Date Release notes ~ | |
691 | |---------|------------|-----------------------------------------------------| | |
692 | 2.6 2011-01-14 * Current release: | |
693 | - Add smart_matchpairs feature. | |
694 | - Add mapping to jump over contiguous delimiters. | |
695 | - Fix behaviour of b:loaded_delimitMate. | |
696 | |---------|------------|-----------------------------------------------------| | |
697 | 2.5.1 2010-09-30 * - Remove visual wrapping. Surround.vim offers a much | |
698 | better implementation. | |
699 | - Minor mods to DelimitMateTest. | |
700 | |---------|------------|-----------------------------------------------------| | |
701 | 2.5 2010-09-22 * - Better handling of mappings. | |
702 | - Add report for mappings in |:DelimitMateTest|. | |
703 | - Allow the use of "|" and multi-byte characters in | |
704 | |'delimitMate_quotes'| and |'delimitMate_matchpairs'|. | |
705 | - Allow commands to be concatenated using |. | |
706 | |---------|------------|-----------------------------------------------------| | |
707 | 2.4.1 2010-07-31 * - Fix problem with <Home> and <End>. | |
708 | - Add missing doc on |'delimitMate_smart_quotes'|, | |
709 | |delimitMateBalance| and | |
710 | |'delimitMate_balance_matchpairs'|. | |
711 | |---------|------------|-----------------------------------------------------| | |
712 | 2.4 2010-07-29 * - Unbalanced parens: see :help delimitMateBalance. | |
713 | - Visual wrapping now works on block-wise visual | |
714 | with some limitations. | |
715 | - Arrow keys didn't work on terminal. | |
716 | - Added option to allow nested quotes. | |
717 | - Expand Smart Quotes to look for a string on the | |
718 | right of the cursor. | |
719 | ||
720 | |---------|------------|-----------------------------------------------------| | |
721 | 2.3.1 2010-06-06 * - Fix: an extra <Space> is inserted after <Space> | |
722 | expansion. | |
723 | ||
724 | |---------|------------|-----------------------------------------------------| | |
725 | 2.3 2010-06-06 * - Syntax aware: Will turn off when editing comments | |
726 | or other regions, customizable. | |
727 | - Changed format of most mappings. | |
728 | - Fix: <CR> expansion doesn't brake automatic | |
729 | indentation adjustments anymore. | |
730 | - Fix: Arrow keys would insert A, B, C or D instead | |
731 | of moving the cursor when using Vim on a terminal. | |
732 | ||
733 | |---------|------------|-----------------------------------------------------| | |
734 | 2.2 2010-05-16 * - Added command to switch the plug-in on and off. | |
735 | - Fix: some problems with <Left>, <Right> and <CR>. | |
736 | - Fix: A small problem when inserting a delimiter at | |
737 | the beginning of the line. | |
738 | ||
739 | |---------|------------|-----------------------------------------------------| | |
740 | 2.1 2010-05-10 * - Most of the functions have been moved to an | |
741 | autoload script to avoid loading unnecessary ones. | |
742 | - Fixed a problem with the redo command. | |
743 | - Many small fixes. | |
744 | ||
745 | |---------|------------|-----------------------------------------------------| | |
746 | 2.0 2010-04-01 * New features: | |
747 | - All features are redo/undo-wise safe. | |
748 | - A single quote typed after an alphanumeric | |
749 | character is considered an apostrophe and one | |
750 | single quote is inserted. | |
751 | - A quote typed after another quote inserts a single | |
752 | quote and the cursor jumps to the middle. | |
753 | - <S-Tab> jumps out of any empty pair. | |
754 | - <CR> and <Space> expansions are fixed, but the | |
755 | functions used for it are global and can be used in | |
756 | custom mappings. The previous system is still | |
757 | active if you have any of the expansion options | |
758 | set. | |
759 | - <S-Backspace> deletes the closing delimiter. | |
760 | * Fixed bug: | |
761 | - s:vars were being used to store buffer options. | |
762 | ||
763 | |---------|------------|-----------------------------------------------------| | |
764 | 1.6 2009-10-10 * Now delimitMate tries to fix the balancing of single | |
765 | quotes when used as apostrophes. You can read | |
766 | |delimitMate_apostrophes| for details. | |
767 | Fixed an error when |b:delimitMate_expand_space| | |
768 | wasn't set but |delimitMate_expand_space| wasn't. | |
769 | ||
770 | |---------|------------|-----------------------------------------------------| | |
771 | 1.5 2009-10-05 * Fix: delimitMate should work correctly for files | |
772 | passed as arguments to Vim. Thanks to Ben Beuchler | |
773 | for helping to nail this bug. | |
774 | ||
775 | |---------|------------|-----------------------------------------------------| | |
776 | 1.4 2009-09-27 * Fix: delimitMate is now enabled on new buffers even | |
777 | if they don't have set the file type option or were | |
778 | opened directly from the terminal. | |
779 | ||
780 | |---------|------------|-----------------------------------------------------| | |
781 | 1.3 2009-09-24 * Now local options can be used along with autocmd | |
782 | for specific file type configurations. | |
783 | Fixes: | |
784 | - Unnamed register content is not lost on visual | |
785 | mode. | |
786 | - Use noremap where appropiate. | |
787 | - Wrapping a single empty line works as expected. | |
788 | ||
789 | |---------|------------|-----------------------------------------------------| | |
790 | 1.2 2009-09-07 * Fixes: | |
791 | - When inside nested empty pairs, deleting the | |
792 | innermost left delimiter would delete all right | |
793 | contiguous delimiters. | |
794 | - When inside an empty pair, inserting a left | |
795 | delimiter wouldn't insert the right one, instead | |
796 | the cursor would jump to the right. | |
797 | - New buffer inside the current window wouldn't | |
798 | have the mappings set. | |
799 | ||
800 | |---------|------------|-----------------------------------------------------| | |
801 | 1.1 2009-08-25 * Fixed an error that ocurred when mapleader wasn't | |
802 | set and added support for GetLatestScripts | |
803 | auto-detection. | |
804 | ||
805 | |---------|------------|-----------------------------------------------------| | |
806 | 1.0 2009-08-23 * Initial upload. | |
807 | ||
808 | |---------|------------|-----------------------------------------------------| | |
809 | ||
810 | ||
811 | `\|||/´ MMM \|/ www __^__ ~ | |
812 | (o o) (o o) @ @ (O-O) /(o o)\\ ~ | |
813 | ooO_(_)_Ooo__ ooO_(_)_Ooo___oOO_(_)_OOo___oOO__(_)__OOo___oOO__(_)__OOo_____ ~ | |
814 | _____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~ | |
815 | __|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_ ~ | |
816 | _____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~ | |
817 | ||
818 | vim:tw=78:et:ts=2:sw=2:ft=help:norl:formatoptions+=tcroqn:autoindent: |