mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-08 05:34:45 +08:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b94c38f95 | ||
|
|
217adb3d8e | ||
|
|
e63e373ae1 | ||
|
|
9c11c5cc82 | ||
|
|
8b24f0fd9f | ||
|
|
701e14f72f | ||
|
|
c9c1464075 | ||
|
|
e831d89acf | ||
|
|
133c125f93 | ||
|
|
b9cea6312a | ||
|
|
1b37d60840 | ||
|
|
a70aa5285e | ||
|
|
2eba04961d | ||
|
|
3519f82f79 | ||
|
|
e9491e473c | ||
|
|
9e3075cff5 | ||
|
|
7c9ba95565 | ||
|
|
3ae285424c | ||
|
|
fa1d3b3d6a | ||
|
|
63f8c2af4f | ||
|
|
29eb98d79d | ||
|
|
5b004ca49d | ||
|
|
34df78f8ab | ||
|
|
e234e45846 | ||
|
|
081ec279ed | ||
|
|
4399fa327f | ||
|
|
ceaa6e01ed | ||
|
|
235f0dcbfb | ||
|
|
fadd7fefbc | ||
|
|
193b6027c2 | ||
|
|
a76439a641 | ||
|
|
89cc598217 | ||
|
|
28ce6213fc | ||
|
|
6d1f48c1bf | ||
|
|
0e20bcaff8 | ||
|
|
aae61ad8ba | ||
|
|
4dac6ce6ac | ||
|
|
875a9e450b | ||
|
|
48d2e3b9d1 | ||
|
|
5626a633d5 | ||
|
|
3652ba24e3 | ||
|
|
740fc90ae7 | ||
|
|
e0de2dbf39 | ||
|
|
efcf9eb341 | ||
|
|
2545fa5967 | ||
|
|
c91674eed2 | ||
|
|
542728671e | ||
|
|
d1621b6672 | ||
|
|
6d1cc1187b | ||
|
|
377c3a37e1 | ||
|
|
d03324135c | ||
|
|
edeaff4730 | ||
|
|
c85fee6eb5 | ||
|
|
0ccb143a12 | ||
|
|
941beed3b3 | ||
|
|
739a3e606c | ||
|
|
61cc934b68 | ||
|
|
7aec4532f9 | ||
|
|
6f22aab0b8 | ||
|
|
592cf2fea1 | ||
|
|
3d818560eb | ||
|
|
da66a3f7c9 | ||
|
|
e5ce5b0967 | ||
|
|
03342b8d22 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
*.sw?
|
||||
*.un?
|
||||
*.vba
|
||||
*.zip
|
||||
*.gz
|
||||
vimball.txt
|
||||
*.orig
|
||||
tags
|
||||
|
||||
33
Makefile
33
Makefile
@@ -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
264
README
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
"}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user