64 Commits
2.2 ... 2.4.1

Author SHA1 Message Date
Israel Chauca Fuentes
4b94c38f95 Release 2.4.1. 2010-07-31 13:01:42 -05:00
Israel Chauca Fuentes
217adb3d8e Update change log. 2010-07-31 10:58:55 -05:00
Israel Chauca Fuentes
e63e373ae1 Reorder doc of options. 2010-07-31 00:48:50 -05:00
Israel Chauca Fuentes
9c11c5cc82 Fix 'smart_quotes' doc. 2010-07-31 00:22:26 -05:00
Israel Chauca Fuentes
8b24f0fd9f Add doc on 'smart_quotes' and delimitMateBalance. 2010-07-30 23:56:21 -05:00
Israel Chauca Fuentes
701e14f72f Rename unbalanced_paren to balance_matchpairs. 2010-07-30 23:54:20 -05:00
Israel Chauca Fuentes
c9c1464075 Silence some noise related to 'backspace'. 2010-07-30 23:51:20 -05:00
Israel Chauca Fuentes
e831d89acf Reset buffer with <Home> and <End>. Closes #27. 2010-07-30 02:59:43 -05:00
Israel Chauca Fuentes
133c125f93 Makefile change. 2010-07-30 02:58:12 -05:00
Israel Chauca Fuentes
b9cea6312a Release 2.4 2010-07-29 18:20:13 -05:00
Israel Chauca Fuentes
1b37d60840 Behave nicely with iminsert and imsearch. Thanks to nailxx@github.com. 2010-07-20 13:27:28 -05:00
Israel Chauca Fuentes
a70aa5285e Doc fix. Missing quotes. 2010-07-20 13:23:41 -05:00
Israel Chauca Fuentes
2eba04961d Added note about abbreviations not being expanded. # 26 2010-07-15 19:20:09 -05:00
Israel Chauca Fuentes
3519f82f79 \<Right\> doesn\'t work under terminal. #25 2010-07-15 04:10:38 -05:00
Israel Chauca Fuentes
e9491e473c Reorder some logic. 2010-07-15 04:07:56 -05:00
Israel Chauca Fuentes
9e3075cff5 Changelog update. 2010-07-03 14:43:20 -05:00
Israel Chauca Fuentes
7c9ba95565 Doc update. 2010-06-28 19:08:27 -05:00
Israel Chauca Fuentes
3ae285424c Expand smart quotes to consider [:alnum:] to the right. 2010-06-28 15:20:32 -05:00
Israel Chauca Fuentes
fa1d3b3d6a Add option to allow nesting quotes. #24 2010-06-28 13:18:04 -05:00
Israel Chauca Fuentes
63f8c2af4f Add note to the docs about <S-BS> not working on terminal. 2010-06-26 13:29:16 -05:00
Israel Chauca Fuentes
29eb98d79d Sort results from Tests#Main(). 2010-06-25 15:18:45 -05:00
Israel Chauca Fuentes
5b004ca49d Comment formatting. 2010-06-25 15:17:51 -05:00
Israel Chauca Fuentes
34df78f8ab Fix vars scope. 2010-06-25 15:17:17 -05:00
Israel Chauca Fuentes
e234e45846 #23 and vars with wrong values. 2010-06-25 15:16:25 -05:00
Israel Chauca Fuentes
081ec279ed Rename internal vars to hide them from completion. 2010-06-25 15:10:50 -05:00
Israel Chauca Fuentes
4399fa327f Doc corrections. 2010-06-23 12:53:58 -05:00
Israel Chauca Fuentes
ceaa6e01ed Deleted IsBlockVisual(). 2010-06-23 12:53:16 -05:00
Israel Chauca Fuentes
235f0dcbfb Fixed duplicate <silent>. 2010-06-23 12:52:18 -05:00
Israel Chauca Fuentes
fadd7fefbc Merge http://github.com/Lokaltog/delimitMate
Conflicts:
	autoload/delimitMate.vim
2010-06-22 21:25:05 -05:00
Israel Chauca Fuentes
193b6027c2 Fix #23. 2010-06-22 21:01:03 -05:00
Kim Silkebækken
a76439a641 Make all mappings silent
This change speeds up vim significantly in a terminal, and prevents the
annoying flickering of commands while typing.
2010-06-20 02:06:23 +02:00
Israel Chauca Fuentes
89cc598217 Update README. 2010-06-16 02:18:52 -05:00
Israel Chauca Fuentes
28ce6213fc Cosmetic changes. 2010-06-16 01:54:58 -05:00
Israel Chauca Fuentes
6d1f48c1bf Fix TestMappings(). 2010-06-16 01:54:40 -05:00
Israel Chauca Fuentes
0e20bcaff8 Use "fork" to open new gvim when testing. 2010-06-16 01:51:53 -05:00
Israel Chauca Fuentes
aae61ad8ba Use 'nomore'. 2010-06-16 01:50:33 -05:00
Israel Chauca Fuentes
4dac6ce6ac Fix TestMappings(). 2010-06-16 01:47:42 -05:00
Israel Chauca Fuentes
875a9e450b Silence some noise on UnMap(). 2010-06-16 01:45:40 -05:00
Israel Chauca Fuentes
48d2e3b9d1 Check for 'backspace' when <CR> expansion is enabled. 2010-06-16 01:44:11 -05:00
Israel Chauca Fuentes
5626a633d5 Escape \\ on options. 2010-06-16 01:40:55 -05:00
Israel Chauca Fuentes
3652ba24e3 Split Init() and simplify the set-up process. 2010-06-16 01:37:08 -05:00
Israel Chauca Fuentes
740fc90ae7 Expansion documentation and intialization fixed. 2010-06-12 22:50:14 -05:00
Israel Chauca Fuentes
e0de2dbf39 Use internal b:vars to read from user options. 2010-06-12 22:15:26 -05:00
Israel Chauca Fuentes
efcf9eb341 Formatting. 2010-06-12 12:28:50 -05:00
Israel Chauca Fuentes
2545fa5967 Reset autocmds on re-loading. 2010-06-12 12:26:30 -05:00
Israel Chauca Fuentes
c91674eed2 Doc update. 2010-06-09 19:10:29 -05:00
Israel Chauca Fuentes
542728671e Fix issue #21. 2010-06-09 12:32:57 -05:00
Israel Chauca Fuentes
d1621b6672 Block-wise visual wrapping works with limitations. 2010-06-09 03:20:11 -05:00
Israel Chauca Fuentes
6d1cc1187b Fixed issue #18 for non xterm terminals. 2010-06-08 21:54:22 -05:00
Israel Chauca Fuentes
377c3a37e1 Do not close on unbalanced parens. 2010-06-08 00:48:34 -05:00
Israel Chauca Fuentes
d03324135c Rename and reorder some function, update doc. 2010-06-07 00:54:55 -05:00
Israel Chauca Fuentes
edeaff4730 Missing quote. 2010-06-06 13:51:31 -05:00
Israel Chauca Fuentes
c85fee6eb5 README update. 2010-06-06 13:28:47 -05:00
Israel Chauca Fuentes
0ccb143a12 Doc and version update. 2010-06-06 13:22:14 -05:00
Israel Chauca Fuentes
941beed3b3 Extend detection of version string in Makefile. 2010-06-06 13:16:55 -05:00
Israel Chauca Fuentes
739a3e606c Fix: extra space inserted after <Space> expansion. 2010-06-06 02:51:30 -05:00
Israel Chauca Fuentes
61cc934b68 Give some feedback for commands. 2010-06-06 02:35:15 -05:00
Israel Chauca Fuentes
7aec4532f9 Change log update and minor doc edits. 2010-06-06 00:41:09 -05:00
Israel Chauca Fuentes
6f22aab0b8 Minor changes. 2010-06-06 00:01:23 -05:00
Israel Chauca Fuentes
592cf2fea1 Fix arrow keys on terminal, #18. 2010-06-02 22:34:01 -05:00
Israel Chauca Fuentes
3d818560eb README update. 2010-05-24 22:16:23 -05:00
Israel Chauca Fuentes
da66a3f7c9 Syntax awareness. 2010-05-24 22:11:23 -05:00
Israel Chauca Fuentes
e5ce5b0967 Fix: automatic indent was broken when expanding <CR>. 2010-05-23 14:29:50 -05:00
Israel Chauca Fuentes
03342b8d22 Makefile update. 2010-05-16 23:59:48 -05:00
7 changed files with 952 additions and 536 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,8 @@
*.sw?
*.un?
*.vba
*.zip
*.gz
vimball.txt
*.orig
tags

View File

@@ -4,18 +4,13 @@ SCRIPT=$(wildcard plugin/*.vim)
AUTOL=autoload/$(PLUGIN).vim
DOC=$(wildcard doc/*.txt)
TESTS=$(wildcard autoload/*Tests.vim)
VERSION=$(shell perl -ne 'if (/\*\sCurrent\srelease:/) {s/^\s+(\d+\.\d+).*$$/\1/;print}' $(DOC))
VIMFOLDER=~/.vim
VERSION=$(shell perl -ne 'if (/\*\sCurrent\srelease:/) {s/^\s+(\d+\.\S+)\s.*$$/\1/;print}' $(DOC))
VIMFOLDER=~/.vim/
VIM=/usr/bin/vim
.PHONY: $(PLUGIN).vba README
install: vimball
@echo install
$(VIM) -N -c ':so %' -c':q!' $(PLUGIN)-$(VERSION).vba
cp -f autoload/$(PLUGIN)Tests.vim $(VIMFOLDER)/autoload/$(PLUGIN)Tests.vim
all: uninstall vimball install README zip gzip
all: vimball README zip gzip
vimball: $(PLUGIN).vba
@@ -25,11 +20,6 @@ clean:
dist-clean: clean
uninstall:
@echo uninstall
$(VIM) -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vba
rm -f $(VIMFOLDER)/autoload/$(PLUGIN)Tests.txt
undo:
for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
@@ -45,9 +35,14 @@ $(PLUGIN).vba:
zip:
@echo zip
rm -f *.zip
zip -r $(PLUGIN).zip doc plugin autoload
zip $(PLUGIN).zip -d \*.sw\?
zip $(PLUGIN).zip -d autoload/$(PLUGIN)Tests.vim
zip $(PLUGIN).zip -d \*.sw\? || echo 1
zip $(PLUGIN).zip -d \*.un\? || echo 1
zip $(PLUGIN).zip -d \*.orig || echo 1
zip $(PLUGIN).zip -d \*tags || echo 1
zip $(PLUGIN).zip -d $(TESTS)
ln -f $(PLUGIN).zip $(PLUGIN)-$(VERSION).zip
gzip: vimball
@echo vimball
@@ -57,11 +52,11 @@ release: version all
version:
@echo version: $(VERSION)
perl -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\d+)/$(VERSION)/e}' $(SCRIPT) $(AUTOL)
perl -i.orig -pne 'if (/let\sdelimitMate_version/) {s/(\d+\.\d+)/$(VERSION)/e}' $(SCRIPT)
perl -i.orig -pne 'if (/beasts/) {s/(v\d+\.\d+)/v.$(VERSION)/e}' $(DOC)
perl -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\S+)/$(VERSION)/}' $(SCRIPT) $(AUTOL)
perl -i.orig -pne 'if (/let\sdelimitMate_version/) {s/"(\d+\.\S+)"/"$(VERSION)"/}' $(SCRIPT)
perl -i.orig -pne 'if (/beasts/) {s/(v\d+\.\S+)/v$(VERSION)/}' $(DOC)
perl -i.orig -MPOSIX -pne 'if (/^"\sModified:/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' $(SCRIPT) $(AUTOL)
perl -i.orig -MPOSIX -pne 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' $(DOC)
perl -i.orig -MPOSIX -pne 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/}' $(DOC)
@echo Version: $(VERSION)
echo:

264
README
View File

@@ -1,18 +1,20 @@
*delimitMate* Trying to keep those beasts at bay! v2.2 *delimitMate.txt*
*delimitMate* Trying to keep those beasts at bay! v2.4.1 *delimitMate.txt*
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMM MMMMMMMMMMMMMMMMMMMMM ~
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMMMMMMMMMMMMMMMMMMM
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMM MMM M M MMMMMMMMMM MMMMMMMMM ~
MMMM MMM MMM MM MM M M MMM MM MM MM MM MMM MMM MMM MM
MM MM M MM MMMMMM MMMMMMM MMM MMMMM MM M MMM MMM M M ~
M M MM MM MM MM M M MM MMM MMM MMMMM MMMMM MMM MMM M
M M MM MMMMM MM MM M M MM MMM MMM MMMMM MMM MMM MMM MMMM ~
M M MM M MM MM MM M M MM MMM MMM MMMMM MM M MMM MMM M M
MM MMM MMM MM MM M M MM MMM MM MMMMM MMM MMM MMM MM ~
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
========================================================================= ~
==== ========= ========================== ===== ===================== ~
==== ========= ========================== === ===================== ~
==== ========= ===================== === = = ========== ========= ~
==== === === == == = = === == == == == === === === == ~
== == = == ====== ======= === ===== == = === === = = ~
= = == == == == = = == === === ===== ===== === === = ~
= = == ===== == == = = == === === ===== === === === ==== ~
= = == = == == == = = == === === ===== == = === === = = ~
== === === == == = = == === == ===== === === === == ~
========================================================================= ~
REFERENCE MANUAL *
==============================================================================
0.- CONTENTS *delimitMate-contents*
@@ -24,7 +26,9 @@
2.3 Backspace__________________________|delimitMateBackspace|
2.4 Visual wrapping____________________|delimitMateVisualWrapping|
2.5 Smart Quotes_______________________|delimitMateSmartQuotes|
2.6 FileType based configuration_______|delimitMateFileType|
2.6 Balancing matching pairs___________|delimitMateBalance|
2.7 FileType based configuration_______|delimitMateFileType|
2.8 Syntax awareness___________________|delimitMateSyntax|
3. Customization___________________________|delimitMateOptions|
3.1 Options summary____________________|delimitMateOptionSummary|
3.2 Options details____________________|delimitMateOptionDetails|
@@ -39,7 +43,7 @@
1.- INTRODUCTION *delimitMateIntro*
This plug-in provides automatic closing of quotes, parenthesis, brackets,
etc., besides some other related features that should make your time in insert
etc.; besides some other related features that should make your time in insert
mode a little bit easier.
Most of the features can be modified or disabled permanently, using global
@@ -87,6 +91,9 @@ Without auto-close: >
-|
()<S-Tab> | ()|
<
NOTE: Abbreviations will not be expanded by delimiters used on delimitMate,
you should use <C-]> (read |i_CTRL-]|) to expand them on the go.
------------------------------------------------------------------------------
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
@@ -122,8 +129,9 @@ If you press backspace inside an empty pair, both delimiters are deleted. When
expansions are enabled, <BS> will also delete the expansions. NOTE that
deleting <CR> expansions will brake the redo command.
If you type shift + backspace instead, only the closing delimiter will be
deleted.
If you type <S-BS> (shift + backspace) instead, only the closing delimiter
will be deleted. NOTE that this will not usually work when using Vim from the
terminal, see 'delimitMate#JumpAny()' below to see how to fix it.
e.g. typing at the "|": >
@@ -146,8 +154,9 @@ e.g. typing at the "|": >
When visual mode is active this script allows for the selection to be enclosed
with delimiters. But, since brackets have special meaning in visual mode, a
leader (the value of 'mapleader' by default) should precede the delimiter.
NOTE that this feature brakes the redo command and doesn't currently work on
blockwise visual mode, any suggestions will be welcome.
NOTE that this feature brakes the redo command and doesn't currently work well
on blockwise visual mode when the selection has lines one character smaller
than the rest, any suggestions to fix this will be very welcome.
e.g. (selection represented between square brackets): >
@@ -159,9 +168,10 @@ e.g. (selection represented between square brackets): >
------------------------------------------------------------------------------
2.5 SMART QUOTES *delimitMateSmartQuotes*
Only one quote will be inserted following a quote, a "\" or an alphanumeric
character. This should cover closing quotes, escaped quotes and apostrophes.
Except for apostrophes, this feature can be disabled setting the option
Only one quote will be inserted following a quote, a "\" or, following or
preceding an alphanumeric character. This should cover closing quotes after a
string, opening quotes before a string, escaped quotes and apostrophes. Except
for apostrophes, this feature can be disabled setting the option
|'delimitMate_smart_quotes'| to 0.
e.g. typing at the "|": >
@@ -173,7 +183,22 @@ e.g. typing at the "|": >
' | I| | I'|
<
------------------------------------------------------------------------------
2.6 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
2.6 BALANCING MATCHING PAIRS *delimitMateBalance*
When inserting an opening paren and |'delimitMate_balance_matchpairs'| is
enabled, delimitMate will try to balance the closing pairs in the current
line.
e.g. typing at the "|": >
What | Before | After
=======================================
( | |) | (|)
( | | | (|)
( | (|) | ((|))
<
------------------------------------------------------------------------------
2.7 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
delimitMate options can be set globally for all buffers using global
("regular") variables in your |vimrc| file. But |:autocmd| can be used to set
@@ -189,9 +214,23 @@ the following way: >
| - File types for which the option will be set.
- Don't forget to put this event.
<
NOTE that if you use buffer variables (|b:vars|) to set global settings in
your vimrc, those settings will be set for the first buffer, but they'll be
ignored for new buffers and default values will be set.
NOTE that you should use buffer variables (|b:var|) only to set options with
|:autocmd|, for global options use regular variables (|g:var|) in your vimrc.
------------------------------------------------------------------------------
2.8 SYNTAX AWARENESS *delimitMateSyntax*
The features of this plug-in might not be always helpful, comments and strings
usualy don't need auto-completion. delimitMate monitors which region is being
edited and if it detects that the cursor is in a comment it'll turn itself off
until the cursor leaves the comment. The excluded regions can be set using the
option |'delimitMate_excluded_regions'|. Read |group-name| for a list of
regions or syntax group names.
NOTE that this feature relies on a proper syntax file for the current file
type, if the appropiate syntax file doesn't define a region, delimitMate won't
know about it.
==============================================================================
3. CUSTOMIZATION *delimitMateOptions*
@@ -216,12 +255,23 @@ specific file types, see |delimitMateOptionDetails| for examples.
|'delimitMate_quotes'| Tells delimitMate which quotes should be
used.
|'delimitMate_nesting_quotes'| Tells delimitMate which quotes should be
allowed to be nested.
|'delimitMate_visual_leader'| Sets the leader to be used in visual mode.
|'delimitMate_expand_cr'| Turns on/off the expansion of <CR>.
|'delimitMate_expand_space'| Turns on/off the expansion of <Space>.
|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
|'delimitMate_balance_matchpairs'|Turns on/off the "balance matching pairs"
feature.
|'delimitMate_excluded_regions'| Turns off the script for the given regions or
syntax group names.
|'delimitMate_excluded_ft'| Turns off the script for the given file types.
|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
@@ -229,8 +279,6 @@ specific file types, see |delimitMateOptionDetails| for examples.
apostrophes. NOTE: Not needed any more, kept
for compatibility with older versions.
|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
------------------------------------------------------------------------------
3.2 OPTIONS DETAILS *delimitMateOptionDetails*
@@ -266,7 +314,7 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_matchpairs'*
*'b:delimitMate_matchpairs'*
Values: A string with |matchpairs| syntax. ~
Values: A string with |'matchpairs'| syntax. ~
Default: &matchpairs ~
Use this option to tell delimitMate which characters should be considered
@@ -284,9 +332,21 @@ Default: "\" ' `" ~
Use this option to tell delimitMate which characters should be considered as
quotes. Read |delimitMateAutoClose| for details.
e.g.: >
let b:delimitMate_quotes = "\" ' ` *"
let delimitMate_quotes = "\" ' ` *"
au FileType html let b:delimitMate_quotes = "\" '"
<
------------------------------------------------------------------------------
*'delimitMate_nesting_quotes'*
*'b:delimitMate_nesting_quotes'*
Values: A list of quotes. ~
Default: [] ~
Quotes listed here will not be able to jump out of the empty pair, thus
allowing the autoclosed quotes to be nested.
e.g.: >
let delimitMate_nesting_quotes = ['"','`']
au FileType python let b:delimitMate_nesting_quotes = ['"']
<
------------------------------------------------------------------------------
*'delimitMate_visual_leader'*
*'b:delimitMate_visual_leader'*
@@ -308,20 +368,54 @@ Default: 0 ~
This option turns on/off the expansion of <CR>. Read |delimitMateExpansion|
for details.
e.g.: >
let b:delimitMate_expand_cr = "\<CR>\<CR>\<Up>"
au FileType mail let b:delimitMate_expand_cr = "\<CR>"
let delimitMate_expand_cr = 1
au FileType mail let b:delimitMate_expand_cr = 1
<
------------------------------------------------------------------------------
*'delimitMate_expand_space'*
*'b:delimitMate_expand_space'*
Values: A key mapping. ~
Default: "\<Space>" ~
Values: 1 or 0 ~
Default: 0 ~
This option turns on/off the expansion of <Space>. Read |delimitMateExpansion|
for details.
e.g.: >
let delimitMate_expand_space = "\<Space>\<Space>\<Left>"
au FileType tcl let b:delimitMate_expand_space = "\<Space>"
let delimitMate_expand_space = 1
au FileType tcl let b:delimitMate_expand_space = 1
<
------------------------------------------------------------------------------
*'delimitMate_smart_quotes'*
*'b:delimitMate_smart_quotes'*
Values: 1 or 0 ~
Default: 1 ~
This option turns on/off the smart quotes feature. Read
|delimitMateSmartQuotes| for details.
e.g.: >
let delimitMate_smart_quotes = 0
au FileType tcl let b:delimitMate_smart_quotes = 0
<
------------------------------------------------------------------------------
*'delimitMate_balance_matchpairs'*
*'b:delimitMate_balance_matchpairs'*
Values: 1 or 0 ~
Default: 0 ~
This option turns on/off the balancing of matching pairs. Read
|delimitMateBalance| for details.
e.g.: >
let delimitMate_balance_matchpairs = 1
au FileType tcl let b:delimitMate_balance_matchpairs = 1
<
------------------------------------------------------------------------------
*'delimitMate_excluded_regions'*
Values: A string of syntax group names names separated by single commas. ~
Default: Comment ~
This options turns delimitMate off for the listed regions, read |group-name|
for more info about what is a region.
e.g.: >
let delimitMate_excluded_regions = "Comments,String"
<
------------------------------------------------------------------------------
*'delimitMate_excluded_ft'*
@@ -437,31 +531,41 @@ represented by an "|": >
==============================================================================
5. FUNCTIONS *delimitMateFunctions*
Functions should be used enclosed between <C-R>= and <CR>, otherwise they
might not work as expected or at all.
------------------------------------------------------------------------------
delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair*
delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair()*
Returns 1 if the cursor is inside an empty pair, 0 otherwise.
e.g.: >
inoremap <expr> <CR> delimitMate#WithinEmptyPair() ?
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>" :
\ "external_mapping"
<
------------------------------------------------------------------------------
delimitMate#ExpandReturn() *delimitMate#ExpandReturn()*
Returns the expansion for <CR>.
Returns the expansion for <CR> if enabled and inside an empty pair, returns
<CR> otherwise.
e.g.: This mapping could be used to select an item on a pop-up menu or expand
<CR> inside an empty pair: >
inoremap <expr> <CR> pumvisible() ? "\<c-y>" :
\ delimitMate#WithinEmptyPair() ?
\ delimitMate#ExpandReturn() : "\<CR>"
inoremap <expr> <CR> pumvisible() ?
\"\<c-y>" :
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>"
<
------------------------------------------------------------------------------
delimitMate#ExpandSpace() *delimitMate#ExpandSpace()*
Returns the expansion for <Space>.
Returns the expansion for <Space> if enabled and inside an empty pair, returns
<Space> otherwise.
e.g.: >
inoremap <expr> <Space> delimitMate#WithinEmptyPair() ?
\ delimitMate#ExpandSpace() : "\<Space>"
inoremap <Space> <C-R>=delimitMate#ExpandSpace()<CR>
<
------------------------------------------------------------------------------
delimitMate#ShouldJump() *delimitMate#ShouldJump()*
@@ -470,21 +574,20 @@ Returns 1 if there is a closing delimiter or a quote to the right of the
cursor, 0 otherwise.
------------------------------------------------------------------------------
delimitMate#JumpAny() *delimitMate#JumpAny()*
delimitMate#JumpAny(key) *delimitMate#JumpAny()*
This function returns a mapping that will make the cursor jump to the right.
This function returns a mapping that will make the cursor jump to the right
when delimitMate#ShouldJump() returns 1, returns the argument "key" otherwise.
e.g.: You can use this to create your own mapping to jump over any delimiter.
>
inoremap <expr> <C-Tab> delimitMate#ShouldJump() ?
\ delimitMate#JumpAny() : "\<C-Tab>"
inoremap <C-Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR>
<
==============================================================================
6. TODO LIST *delimitMateTodo*
- Automatic set-up by file type.
- Make visual wrapping work on blockwise visual mode.
- Limit behaviour by region.
- Make block-wise visual wrapping work on un-even regions.
==============================================================================
7. MAINTAINER *delimitMateMaintainer*
@@ -509,26 +612,64 @@ from the following sources:
From the comments on the previous blog post and from:
http://gist.github.com/144619
- Vim Scripts:
http://www.vim.org/scripts
- Karl Guertin
AutoClose:
http://www.vim.org/scripts/script.php?script_id=1849
This script was inspired by the auto-completion of delimiters of TextMate.
- Thiago Alves
AutoClose:
http://www.vim.org/scripts/script.php?script_id=2009
- Edoardo Vacchi
ClosePairs:
http://www.vim.org/scripts/script.php?script_id=2373
This script was inspired by the auto-completion of delimiters on TextMate.
==============================================================================
9. HISTORY *delimitMateHistory*
Version Date Release notes ~
|---------|------------|-----------------------------------------------------|
2.2 2010-05-16 * Current release:
- Added command to switch the plug-in on and off.
2.4.1 2010-07-31 * Current release:
- Fix problem with <Home> and <End>.
- Add missing doc on |'delimitMate_smart_quotes'|,
|delimitMateBalance| and
|'delimitMate_balance_matchpairs'|.
|---------|------------|-----------------------------------------------------|
2.4 2010-07-29 * - Unbalanced parens: see :help delimitMateBalance.
- Visual wrapping now works on block-wise visual
with some limitations.
- Arrow keys didn't work on terminal.
- Added option to allow nested quotes.
- Expand Smart Quotes to look for a string on the
right of the cursor.
|---------|------------|-----------------------------------------------------|
2.3.1 2010-06-06 * - Fix: an extra <Space> is inserted after <Space>
expansion.
|---------|------------|-----------------------------------------------------|
2.3 2010-06-06 * - Syntax aware: Will turn off when editing comments
or other regions, customizable.
- Changed format of most mappings.
- Fix: <CR> expansion doesn't brake automatic
indentation adjustments anymore.
- Fix: Arrow keys would insert A, B, C or D instead
of moving the cursor when using Vim on a terminal.
|---------|------------|-----------------------------------------------------|
2.2 2010-05-16 * - Added command to switch the plug-in on and off.
- Fix: some problems with <Left>, <Right> and <CR>.
- Fix: A small problem when inserting a delimiter at
the beginning of the line.
|---------|------------|-----------------------------------------------------|
2.1 2010-05-10 * - Most of the functions have been moved to an
autoload script to avoid loading unnecessary ones.
- Fixed a problem with the redo command.
- Many small fixes.
|---------|------------|-----------------------------------------------------|
2.0 2010-04-01 * New features:
- All features are redo/undo-wise safe.
@@ -544,7 +685,6 @@ This script was inspired by the auto-completion of delimiters of TextMate.
active if you have any of the expansion options
set.
- <S-Backspace> deletes the closing delimiter.
* Fixed bug:
- s:vars were being used to store buffer options.
@@ -596,9 +736,11 @@ This script was inspired by the auto-completion of delimiters of TextMate.
|---------|------------|-----------------------------------------------------|
... |"| _ _ . . ___ ~
o,*,(o o) _|_|_ o' \,=./ `o . .:::. /_\ `* ~
8(o o)(_)Ooo (o o) (o o) :(o o): . (o o) ~
---ooO-(_)---Ooo----ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- ~
`\|||/´ MMM \|/ www __^__ ~
(o o) (o o) @ @ (O-O) /(o o)\\ ~
ooO_(_)_Ooo__ ooO_(_)_Ooo___oOO_(_)_OOo___oOO__(_)__OOo___oOO__(_)__OOo_____ ~
_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
__|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_ ~
_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
vim:tw=78:ts=8:ft=help:norl:formatoptions+=tcroqn:autoindent:
vim:tw=78:et:ts=2:sw=2:ft=help:norl:formatoptions+=tcroqn:autoindent:

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,14 @@
function! delimitMateTests#Main() " {{{
function! delimitMateTests#Main()
if !exists("g:delimitMate_testing")
echoerr "delimitMateTests#Main(): If you really want to use me, you must set delimitMate_testing to any value."
return
elseif g:delimitMate_testing == "fork"
!gvim -N -u NONE -U NONE -c "set backspace=eol,start" -c "set background=light" -c "syntax on" -c "let delimitMate_testing = 1" -c "so autoload/delimitMate.vim" -c "so autoload/delimitMateTests.vim" -c "so plugin/delimitMate.vim" -c "call delimitMateTests\#Main()"
return ""
endif
nmap <F1> :qall!<CR>
let nomore = &more
set nomore
let b:test_results = {}
let b:errors = 0
let b:corrects = 0
@@ -45,6 +50,7 @@ function! delimitMateTests#Main() " {{{
normal gg.
endif
exec "normal \<Esc>"
call setpos('.', [0, 1, 1, 0])
let result = len(a:output) != line('$')
for line in a:output
@@ -226,7 +232,12 @@ function! delimitMateTests#Main() " {{{
" Deactivate parens on comments: The first call to a closing delimiter
" will not work here as expected, but it does in real life tests.
set ft=vim
call Type("Deactivate parens on comments", "\"()", ["\"()"], ["autoclose:0"], 1)
call Type("Deactivate parens on comments", "\"()[]", ["\"()[]|"], ["autoclose:0"], 1)
set ft=
" Deactivate quotes on comments: See previous note.
set ft=vim
call Type("Deactivate parens on comments", "\"(`", ["\"(``|"], [], 1)
set ft=
" Manual close at start of line
@@ -240,9 +251,10 @@ function! delimitMateTests#Main() " {{{
call append(0, "*TESTS REPORT: " . b:errors . " failed, " . b:corrects . " passed and " . b:ignores . " ignored.")
normal "_ddgg
let @/ = ".\\+Failed:.*!="
2,$sort /^.\+':/
normal gg
exec search('Ignored:','nW').",$sort! /^.\\+':/"
set nohlsearch
"syntax match failedLine "^.*Failed.*$" contains=ALL
"syn match passedLine ".*Passed.*"
syn match lineIgnored ".*Ignored.*"
syn match labelPassed "'\@<=.\+\(': 'Passed\)\@="
syn match labelFailed "'\@<=.\+\(': 'Failed\)\@="
@@ -262,6 +274,8 @@ function! delimitMateTests#Main() " {{{
hi def link resultSummary SpecialComment
hi def link resultSummaryNumber Error
" }}}
endfunction " }}}
let &more = nomore
endfunction
" vim:foldmethod=marker:foldcolumn=4

View File

@@ -1,18 +1,20 @@
*delimitMate* Trying to keep those beasts at bay! v2.2 *delimitMate.txt*
*delimitMate* Trying to keep those beasts at bay! v2.4.1 *delimitMate.txt*
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMM MMMMMMMMMMMMMMMMMMMMM ~
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMMMMMMMMMMMMMMMMMMM
MMMM MMMMMMMMM MMMMMMMMMMMMMMMMMMMMM MMM M M MMMMMMMMMM MMMMMMMMM ~
MMMM MMM MMM MM MM M M MMM MM MM MM MM MMM MMM MMM MM
MM MM M MM MMMMMM MMMMMMM MMM MMMMM MM M MMM MMM M M ~
M M MM MM MM MM M M MM MMM MMM MMMMM MMMMM MMM MMM M
M M MM MMMMM MM MM M M MM MMM MMM MMMMM MMM MMM MMM MMMM ~
M M MM M MM MM MM M M MM MMM MMM MMMMM MM M MMM MMM M M
MM MMM MMM MM MM M M MM MMM MM MMMMM MMM MMM MMM MM ~
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
========================================================================= ~
==== ========= ========================== ===== ===================== ~
==== ========= ========================== === ===================== ~
==== ========= ===================== === = = ========== ========= ~
==== === === == == = = === == == == == === === === == ~
== == = == ====== ======= === ===== == = === === = = ~
= = == == == == = = == === === ===== ===== === === = ~
= = == ===== == == = = == === === ===== === === === ==== ~
= = == = == == == = = == === === ===== == = === === = = ~
== === === == == = = == === == ===== === === === == ~
========================================================================= ~
REFERENCE MANUAL *
==============================================================================
0.- CONTENTS *delimitMate-contents*
@@ -24,7 +26,9 @@
2.3 Backspace__________________________|delimitMateBackspace|
2.4 Visual wrapping____________________|delimitMateVisualWrapping|
2.5 Smart Quotes_______________________|delimitMateSmartQuotes|
2.6 FileType based configuration_______|delimitMateFileType|
2.6 Balancing matching pairs___________|delimitMateBalance|
2.7 FileType based configuration_______|delimitMateFileType|
2.8 Syntax awareness___________________|delimitMateSyntax|
3. Customization___________________________|delimitMateOptions|
3.1 Options summary____________________|delimitMateOptionSummary|
3.2 Options details____________________|delimitMateOptionDetails|
@@ -39,7 +43,7 @@
1.- INTRODUCTION *delimitMateIntro*
This plug-in provides automatic closing of quotes, parenthesis, brackets,
etc., besides some other related features that should make your time in insert
etc.; besides some other related features that should make your time in insert
mode a little bit easier.
Most of the features can be modified or disabled permanently, using global
@@ -87,6 +91,9 @@ Without auto-close: >
-|
()<S-Tab> | ()|
<
NOTE: Abbreviations will not be expanded by delimiters used on delimitMate,
you should use <C-]> (read |i_CTRL-]|) to expand them on the go.
------------------------------------------------------------------------------
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
@@ -122,8 +129,9 @@ If you press backspace inside an empty pair, both delimiters are deleted. When
expansions are enabled, <BS> will also delete the expansions. NOTE that
deleting <CR> expansions will brake the redo command.
If you type shift + backspace instead, only the closing delimiter will be
deleted.
If you type <S-BS> (shift + backspace) instead, only the closing delimiter
will be deleted. NOTE that this will not usually work when using Vim from the
terminal, see 'delimitMate#JumpAny()' below to see how to fix it.
e.g. typing at the "|": >
@@ -146,8 +154,9 @@ e.g. typing at the "|": >
When visual mode is active this script allows for the selection to be enclosed
with delimiters. But, since brackets have special meaning in visual mode, a
leader (the value of 'mapleader' by default) should precede the delimiter.
NOTE that this feature brakes the redo command and doesn't currently work on
blockwise visual mode, any suggestions will be welcome.
NOTE that this feature brakes the redo command and doesn't currently work well
on blockwise visual mode when the selection has lines one character smaller
than the rest, any suggestions to fix this will be very welcome.
e.g. (selection represented between square brackets): >
@@ -159,9 +168,10 @@ e.g. (selection represented between square brackets): >
------------------------------------------------------------------------------
2.5 SMART QUOTES *delimitMateSmartQuotes*
Only one quote will be inserted following a quote, a "\" or an alphanumeric
character. This should cover closing quotes, escaped quotes and apostrophes.
Except for apostrophes, this feature can be disabled setting the option
Only one quote will be inserted following a quote, a "\" or, following or
preceding an alphanumeric character. This should cover closing quotes after a
string, opening quotes before a string, escaped quotes and apostrophes. Except
for apostrophes, this feature can be disabled setting the option
|'delimitMate_smart_quotes'| to 0.
e.g. typing at the "|": >
@@ -173,7 +183,22 @@ e.g. typing at the "|": >
' | I| | I'|
<
------------------------------------------------------------------------------
2.6 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
2.6 BALANCING MATCHING PAIRS *delimitMateBalance*
When inserting an opening paren and |'delimitMate_balance_matchpairs'| is
enabled, delimitMate will try to balance the closing pairs in the current
line.
e.g. typing at the "|": >
What | Before | After
=======================================
( | |) | (|)
( | | | (|)
( | (|) | ((|))
<
------------------------------------------------------------------------------
2.7 FILE TYPE BASED CONFIGURATION *delimitMateFileType*
delimitMate options can be set globally for all buffers using global
("regular") variables in your |vimrc| file. But |:autocmd| can be used to set
@@ -189,9 +214,23 @@ the following way: >
| - File types for which the option will be set.
- Don't forget to put this event.
<
NOTE that if you use buffer variables (|b:vars|) to set global settings in
your vimrc, those settings will be set for the first buffer, but they'll be
ignored for new buffers and default values will be set.
NOTE that you should use buffer variables (|b:var|) only to set options with
|:autocmd|, for global options use regular variables (|g:var|) in your vimrc.
------------------------------------------------------------------------------
2.8 SYNTAX AWARENESS *delimitMateSyntax*
The features of this plug-in might not be always helpful, comments and strings
usualy don't need auto-completion. delimitMate monitors which region is being
edited and if it detects that the cursor is in a comment it'll turn itself off
until the cursor leaves the comment. The excluded regions can be set using the
option |'delimitMate_excluded_regions'|. Read |group-name| for a list of
regions or syntax group names.
NOTE that this feature relies on a proper syntax file for the current file
type, if the appropiate syntax file doesn't define a region, delimitMate won't
know about it.
==============================================================================
3. CUSTOMIZATION *delimitMateOptions*
@@ -216,12 +255,23 @@ specific file types, see |delimitMateOptionDetails| for examples.
|'delimitMate_quotes'| Tells delimitMate which quotes should be
used.
|'delimitMate_nesting_quotes'| Tells delimitMate which quotes should be
allowed to be nested.
|'delimitMate_visual_leader'| Sets the leader to be used in visual mode.
|'delimitMate_expand_cr'| Turns on/off the expansion of <CR>.
|'delimitMate_expand_space'| Turns on/off the expansion of <Space>.
|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
|'delimitMate_balance_matchpairs'|Turns on/off the "balance matching pairs"
feature.
|'delimitMate_excluded_regions'| Turns off the script for the given regions or
syntax group names.
|'delimitMate_excluded_ft'| Turns off the script for the given file types.
|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
@@ -229,8 +279,6 @@ specific file types, see |delimitMateOptionDetails| for examples.
apostrophes. NOTE: Not needed any more, kept
for compatibility with older versions.
|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
------------------------------------------------------------------------------
3.2 OPTIONS DETAILS *delimitMateOptionDetails*
@@ -266,7 +314,7 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_matchpairs'*
*'b:delimitMate_matchpairs'*
Values: A string with |matchpairs| syntax. ~
Values: A string with |'matchpairs'| syntax. ~
Default: &matchpairs ~
Use this option to tell delimitMate which characters should be considered
@@ -284,9 +332,21 @@ Default: "\" ' `" ~
Use this option to tell delimitMate which characters should be considered as
quotes. Read |delimitMateAutoClose| for details.
e.g.: >
let b:delimitMate_quotes = "\" ' ` *"
let delimitMate_quotes = "\" ' ` *"
au FileType html let b:delimitMate_quotes = "\" '"
<
------------------------------------------------------------------------------
*'delimitMate_nesting_quotes'*
*'b:delimitMate_nesting_quotes'*
Values: A list of quotes. ~
Default: [] ~
Quotes listed here will not be able to jump out of the empty pair, thus
allowing the autoclosed quotes to be nested.
e.g.: >
let delimitMate_nesting_quotes = ['"','`']
au FileType python let b:delimitMate_nesting_quotes = ['"']
<
------------------------------------------------------------------------------
*'delimitMate_visual_leader'*
*'b:delimitMate_visual_leader'*
@@ -308,20 +368,54 @@ Default: 0 ~
This option turns on/off the expansion of <CR>. Read |delimitMateExpansion|
for details.
e.g.: >
let b:delimitMate_expand_cr = "\<CR>\<CR>\<Up>"
au FileType mail let b:delimitMate_expand_cr = "\<CR>"
let delimitMate_expand_cr = 1
au FileType mail let b:delimitMate_expand_cr = 1
<
------------------------------------------------------------------------------
*'delimitMate_expand_space'*
*'b:delimitMate_expand_space'*
Values: A key mapping. ~
Default: "\<Space>" ~
Values: 1 or 0 ~
Default: 0 ~
This option turns on/off the expansion of <Space>. Read |delimitMateExpansion|
for details.
e.g.: >
let delimitMate_expand_space = "\<Space>\<Space>\<Left>"
au FileType tcl let b:delimitMate_expand_space = "\<Space>"
let delimitMate_expand_space = 1
au FileType tcl let b:delimitMate_expand_space = 1
<
------------------------------------------------------------------------------
*'delimitMate_smart_quotes'*
*'b:delimitMate_smart_quotes'*
Values: 1 or 0 ~
Default: 1 ~
This option turns on/off the smart quotes feature. Read
|delimitMateSmartQuotes| for details.
e.g.: >
let delimitMate_smart_quotes = 0
au FileType tcl let b:delimitMate_smart_quotes = 0
<
------------------------------------------------------------------------------
*'delimitMate_balance_matchpairs'*
*'b:delimitMate_balance_matchpairs'*
Values: 1 or 0 ~
Default: 0 ~
This option turns on/off the balancing of matching pairs. Read
|delimitMateBalance| for details.
e.g.: >
let delimitMate_balance_matchpairs = 1
au FileType tcl let b:delimitMate_balance_matchpairs = 1
<
------------------------------------------------------------------------------
*'delimitMate_excluded_regions'*
Values: A string of syntax group names names separated by single commas. ~
Default: Comment ~
This options turns delimitMate off for the listed regions, read |group-name|
for more info about what is a region.
e.g.: >
let delimitMate_excluded_regions = "Comments,String"
<
------------------------------------------------------------------------------
*'delimitMate_excluded_ft'*
@@ -437,31 +531,41 @@ represented by an "|": >
==============================================================================
5. FUNCTIONS *delimitMateFunctions*
Functions should be used enclosed between <C-R>= and <CR>, otherwise they
might not work as expected or at all.
------------------------------------------------------------------------------
delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair*
delimitMate#WithinEmptyPair() *delimitMate_WithinEmptyPair()*
Returns 1 if the cursor is inside an empty pair, 0 otherwise.
e.g.: >
inoremap <expr> <CR> delimitMate#WithinEmptyPair() ?
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>" :
\ "external_mapping"
<
------------------------------------------------------------------------------
delimitMate#ExpandReturn() *delimitMate#ExpandReturn()*
Returns the expansion for <CR>.
Returns the expansion for <CR> if enabled and inside an empty pair, returns
<CR> otherwise.
e.g.: This mapping could be used to select an item on a pop-up menu or expand
<CR> inside an empty pair: >
inoremap <expr> <CR> pumvisible() ? "\<c-y>" :
\ delimitMate#WithinEmptyPair() ?
\ delimitMate#ExpandReturn() : "\<CR>"
inoremap <expr> <CR> pumvisible() ?
\"\<c-y>" :
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>"
<
------------------------------------------------------------------------------
delimitMate#ExpandSpace() *delimitMate#ExpandSpace()*
Returns the expansion for <Space>.
Returns the expansion for <Space> if enabled and inside an empty pair, returns
<Space> otherwise.
e.g.: >
inoremap <expr> <Space> delimitMate#WithinEmptyPair() ?
\ delimitMate#ExpandSpace() : "\<Space>"
inoremap <Space> <C-R>=delimitMate#ExpandSpace()<CR>
<
------------------------------------------------------------------------------
delimitMate#ShouldJump() *delimitMate#ShouldJump()*
@@ -470,21 +574,20 @@ Returns 1 if there is a closing delimiter or a quote to the right of the
cursor, 0 otherwise.
------------------------------------------------------------------------------
delimitMate#JumpAny() *delimitMate#JumpAny()*
delimitMate#JumpAny(key) *delimitMate#JumpAny()*
This function returns a mapping that will make the cursor jump to the right.
This function returns a mapping that will make the cursor jump to the right
when delimitMate#ShouldJump() returns 1, returns the argument "key" otherwise.
e.g.: You can use this to create your own mapping to jump over any delimiter.
>
inoremap <expr> <C-Tab> delimitMate#ShouldJump() ?
\ delimitMate#JumpAny() : "\<C-Tab>"
inoremap <C-Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR>
<
==============================================================================
6. TODO LIST *delimitMateTodo*
- Automatic set-up by file type.
- Make visual wrapping work on blockwise visual mode.
- Limit behaviour by region.
- Make block-wise visual wrapping work on un-even regions.
==============================================================================
7. MAINTAINER *delimitMateMaintainer*
@@ -509,26 +612,64 @@ from the following sources:
From the comments on the previous blog post and from:
http://gist.github.com/144619
- Vim Scripts:
http://www.vim.org/scripts
- Karl Guertin
AutoClose:
http://www.vim.org/scripts/script.php?script_id=1849
This script was inspired by the auto-completion of delimiters of TextMate.
- Thiago Alves
AutoClose:
http://www.vim.org/scripts/script.php?script_id=2009
- Edoardo Vacchi
ClosePairs:
http://www.vim.org/scripts/script.php?script_id=2373
This script was inspired by the auto-completion of delimiters on TextMate.
==============================================================================
9. HISTORY *delimitMateHistory*
Version Date Release notes ~
|---------|------------|-----------------------------------------------------|
2.2 2010-05-16 * Current release:
- Added command to switch the plug-in on and off.
2.4.1 2010-07-31 * Current release:
- Fix problem with <Home> and <End>.
- Add missing doc on |'delimitMate_smart_quotes'|,
|delimitMateBalance| and
|'delimitMate_balance_matchpairs'|.
|---------|------------|-----------------------------------------------------|
2.4 2010-07-29 * - Unbalanced parens: see :help delimitMateBalance.
- Visual wrapping now works on block-wise visual
with some limitations.
- Arrow keys didn't work on terminal.
- Added option to allow nested quotes.
- Expand Smart Quotes to look for a string on the
right of the cursor.
|---------|------------|-----------------------------------------------------|
2.3.1 2010-06-06 * - Fix: an extra <Space> is inserted after <Space>
expansion.
|---------|------------|-----------------------------------------------------|
2.3 2010-06-06 * - Syntax aware: Will turn off when editing comments
or other regions, customizable.
- Changed format of most mappings.
- Fix: <CR> expansion doesn't brake automatic
indentation adjustments anymore.
- Fix: Arrow keys would insert A, B, C or D instead
of moving the cursor when using Vim on a terminal.
|---------|------------|-----------------------------------------------------|
2.2 2010-05-16 * - Added command to switch the plug-in on and off.
- Fix: some problems with <Left>, <Right> and <CR>.
- Fix: A small problem when inserting a delimiter at
the beginning of the line.
|---------|------------|-----------------------------------------------------|
2.1 2010-05-10 * - Most of the functions have been moved to an
autoload script to avoid loading unnecessary ones.
- Fixed a problem with the redo command.
- Many small fixes.
|---------|------------|-----------------------------------------------------|
2.0 2010-04-01 * New features:
- All features are redo/undo-wise safe.
@@ -544,7 +685,6 @@ This script was inspired by the auto-completion of delimiters of TextMate.
active if you have any of the expansion options
set.
- <S-Backspace> deletes the closing delimiter.
* Fixed bug:
- s:vars were being used to store buffer options.
@@ -596,9 +736,11 @@ This script was inspired by the auto-completion of delimiters of TextMate.
|---------|------------|-----------------------------------------------------|
... |"| _ _ . . ___ ~
o,*,(o o) _|_|_ o' \,=./ `o . .:::. /_\ `* ~
8(o o)(_)Ooo (o o) (o o) :(o o): . (o o) ~
---ooO-(_)---Ooo----ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- ~
`\|||/´ MMM \|/ www __^__ ~
(o o) (o o) @ @ (O-O) /(o o)\\ ~
ooO_(_)_Ooo__ ooO_(_)_Ooo___oOO_(_)_OOo___oOO__(_)__OOo___oOO__(_)__OOo_____ ~
_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
__|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_ ~
_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____ ~
vim:tw=78:ts=8:ft=help:norl:formatoptions+=tcroqn:autoindent:
vim:tw=78:et:ts=2:sw=2:ft=help:norl:formatoptions+=tcroqn:autoindent:

View File

@@ -1,14 +1,15 @@
" ============================================================================
" File: plugin/delimitMate.vim
" Version: 2.2
" Modified: 2010-05-16
" Version: 2.4.1
" Modified: 2010-07-31
" Description: This plugin provides auto-completion for quotes, parens, etc.
" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
" Manual: Read ":help delimitMate".
" Initialization: {{{
if exists("g:loaded_delimitMate") "{{{
" User doesn't want this plugin, let's get out!
if exists("g:loaded_delimitMate") || &cp
" User doesn't want this plugin or compatible is set, let's get out!
finish
endif
let g:loaded_delimitMate = 1
@@ -25,25 +26,27 @@ if v:version < 700
finish
endif
let s:loaded_delimitMate = 1 " }}}
let delimitMate_version = '2.2'
let s:loaded_delimitMate = 1
let delimitMate_version = "2.4.1"
"}}}
" Tools: {{{
" Functions: {{{
function! s:TestMappingsDo() "{{{
if !exists("g:delimitMate_testing")
silent call delimitMate#TestMappings()
else
let temp_varsDM = [b:delimitMate_expand_space, b:delimitMate_expand_cr, b:delimitMate_autoclose]
let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
for i in [0,1]
let b:delimitMate_expand_space = i
let b:delimitMate_expand_cr = i
for a in [0,1]
let b:delimitMate_autoclose = a
call delimitMate#Init()
call delimitMate#UnMap()
call delimitMate#Map()
call delimitMate#TestMappings()
exec "normal i\<CR>"
normal o
endfor
endfor
let b:delimitMate_expand_space = temp_varsDM[0]
@@ -54,64 +57,84 @@ function! s:TestMappingsDo() "{{{
normal gg
endfunction "}}}
function! s:DelimitMateDo() "{{{
if exists("g:delimitMate_excluded_ft")
function! s:DelimitMateDo(...) "{{{
" Initialize settings:
call delimitMate#Init()
" Check if this file type is excluded:
for ft in split(g:delimitMate_excluded_ft,',')
if ft ==? &filetype
"echomsg "excluded"
if exists("g:delimitMate_excluded_ft") &&
\ index(split(g:delimitMate_excluded_ft, ','), &filetype, 0, 1) >= 0
" Remove any magic:
call delimitMate#UnMap()
" Finish here:
return 1
endif
endfor
" First, remove all magic, if needed:
if exists("b:delimitMate_enabled") && b:delimitMate_enabled == 1
call delimitMate#UnMap()
endif
" Now, add magic:
call delimitMate#Map()
if a:0 > 0
echo "delimitMate has been reset."
endif
try
"echomsg "included"
let save_cpo = &cpo
let save_keymap = &keymap
set keymap=
set cpo&vim
call delimitMate#Init()
finally
let &cpo = save_cpo
let &keymap = save_keymap
endtry
endfunction "}}}
function! s:DelimitMateSwitch() "{{{
if b:delimitMate_enabled
call delimitMate#UnMap()
else
call delimitMate#Init()
if exists("b:delimitMate_enabled") && b:delimitMate_enabled
call delimitMate#UnMap()
echo "delimitMate has been disabled."
else
call delimitMate#UnMap()
call delimitMate#Map()
echo "delimitMate has been enabled."
endif
endfunction "}}}
"}}}
" Commands: {{{
call s:DelimitMateDo()
" Let me refresh without re-loading the buffer:
command! DelimitMateReload call s:DelimitMateDo()
command! DelimitMateReload call s:DelimitMateDo(1)
" Quick test:
command! DelimitMateTest call s:TestMappingsDo()
" Switch On/Off:
command! DelimitMateSwitch call s:DelimitMateSwitch()
"}}}
" Run on file type events.
" Autocommands: {{{
augroup delimitMate
au!
" Run on file type change.
"autocmd VimEnter * autocmd FileType * call <SID>DelimitMateDo()
autocmd FileType * call <SID>DelimitMateDo()
" Run on new buffers.
autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") | call <SID>DelimitMateDo() | endif
autocmd BufNewFile,BufRead,BufEnter *
\ if !exists("b:loaded_delimitMate") |
\ call <SID>DelimitMateDo() |
\ endif
" Flush the char buffer:
autocmd InsertEnter * call delimitMate#FlushBuffer()
autocmd BufEnter * if mode() == 'i' | call delimitMate#FlushBuffer() | endif
autocmd BufEnter *
\ if mode() == 'i' |
\ call delimitMate#FlushBuffer() |
\ endif
"function! s:GetSynRegion () | echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') | endfunction
augroup END
"}}}