mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 05:04:34 +08:00
Compare commits
323 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22e6272b1a | ||
|
|
c4d51a21b3 | ||
|
|
9ec998e87a | ||
|
|
0246f25de8 | ||
|
|
1eafd59b9c | ||
|
|
4eaeef01bf | ||
|
|
fb60f3cc9f | ||
|
|
e362f5a69d | ||
|
|
c97a824ed4 | ||
|
|
37122299b7 | ||
|
|
d882e342f7 | ||
|
|
b1ff7f7942 | ||
|
|
e48ea9f852 | ||
|
|
cb6866f1c3 | ||
|
|
8204ab4cb8 | ||
|
|
6f038350de | ||
|
|
0f6581c6f3 | ||
|
|
7752546515 | ||
|
|
7809c5e171 | ||
|
|
b6cc751cc9 | ||
|
|
24cffe07b3 | ||
|
|
6fddbc5568 | ||
|
|
015e0efe53 | ||
|
|
03a0e5d8b3 | ||
|
|
d970ecc4ca | ||
|
|
353fb9a718 | ||
|
|
4d0060f22b | ||
|
|
65016ebe37 | ||
|
|
85d76972e6 | ||
|
|
c4b5877958 | ||
|
|
2335c4ae27 | ||
|
|
6f1a9d00af | ||
|
|
b99ecfa2e3 | ||
|
|
50d97fd76e | ||
|
|
8bc47fd1c4 | ||
|
|
bc97837c71 | ||
|
|
d24ad6b301 | ||
|
|
81de76fe52 | ||
|
|
5945fdfd14 | ||
|
|
9a77c3aee6 | ||
|
|
342a04b427 | ||
|
|
03e94587ae | ||
|
|
c78a6e6d93 | ||
|
|
470c053a3b | ||
|
|
254a89d67c | ||
|
|
e7b4dedb84 | ||
|
|
21a3ade90c | ||
|
|
8e30e70bcd | ||
|
|
ac792c01b6 | ||
|
|
c23ef684e3 | ||
|
|
b63924f2b2 | ||
|
|
07b7cc969f | ||
|
|
13e52d42ae | ||
|
|
aa9d737763 | ||
|
|
bf2b68edab | ||
|
|
fe9022433d | ||
|
|
6f7e6413ce | ||
|
|
a9a37854da | ||
|
|
0739792d01 | ||
|
|
6f4f1b06d3 | ||
|
|
0049b07a1c | ||
|
|
fe1983cfa1 | ||
|
|
a4ac44a84f | ||
|
|
4c13ed6aee | ||
|
|
eafd832c04 | ||
|
|
e13872fdb2 | ||
|
|
9a9b9edb9a | ||
|
|
0f353bd2b3 | ||
|
|
c1b832bbf8 | ||
|
|
073957f0a1 | ||
|
|
c678061b79 | ||
|
|
12c7d85ff6 | ||
|
|
66834e7209 | ||
|
|
21072cf13e | ||
|
|
d952f6c721 | ||
|
|
0efe44bc70 | ||
|
|
631d72465a | ||
|
|
4024181af2 | ||
|
|
38487bbec8 | ||
|
|
c74a48ccd8 | ||
|
|
df1f32f772 | ||
|
|
f2b9b3a0c2 | ||
|
|
1c45f7bbde | ||
|
|
a1f21e8ef5 | ||
|
|
eba94168ce | ||
|
|
06c1f31632 | ||
|
|
9826c667e0 | ||
|
|
35280c1444 | ||
|
|
82160a5de6 | ||
|
|
07d9fa9ddc | ||
|
|
54853a954c | ||
|
|
f00f6b6cf2 | ||
|
|
d280d23a83 | ||
|
|
821e0019fb | ||
|
|
5ef40e0234 | ||
|
|
399e18d669 | ||
|
|
92fba35d27 | ||
|
|
0528bdac15 | ||
|
|
5db098e953 | ||
|
|
b45536fe8d | ||
|
|
3dde5cc8cb | ||
|
|
5787ec4f59 | ||
|
|
2dc880bf1c | ||
|
|
440f38858f | ||
|
|
f7f895c211 | ||
|
|
654dc14e6e | ||
|
|
543be33b13 | ||
|
|
7345bfddef | ||
|
|
16a35eefab | ||
|
|
74ab16ea5b | ||
|
|
2adbf5a8d7 | ||
|
|
e4a02eb998 | ||
|
|
ad11ab2210 | ||
|
|
6b0d448f6a | ||
|
|
32c9db8f37 | ||
|
|
a77423a46f | ||
|
|
57fd02b2e0 | ||
|
|
14faba1c62 | ||
|
|
8ab087c95c | ||
|
|
61d62e8920 | ||
|
|
7ce61655a7 | ||
|
|
8d133d4726 | ||
|
|
7caa6092b7 | ||
|
|
d98d8c0a0d | ||
|
|
e2d63e38f6 | ||
|
|
579e3520a4 | ||
|
|
90d07a68be | ||
|
|
2cb3f4d5e6 | ||
|
|
3a23e89cb5 | ||
|
|
70e1ac1462 | ||
|
|
d4ba528935 | ||
|
|
8a8aad183f | ||
|
|
cfc6654855 | ||
|
|
f2efe4331b | ||
|
|
dfa7e9b730 | ||
|
|
765bdd80dc | ||
|
|
739d2f9bd4 | ||
|
|
eb7738e4aa | ||
|
|
32f5d8df07 | ||
|
|
7b5887c324 | ||
|
|
0326b7c14a | ||
|
|
1dfe26a538 | ||
|
|
9c1564a22f | ||
|
|
028964cf7d | ||
|
|
5a84c1a746 | ||
|
|
0f9563969d | ||
|
|
d3ffebab74 | ||
|
|
ece6c39a65 | ||
|
|
ad151d3e55 | ||
|
|
b65d719353 | ||
|
|
a42dff4ad8 | ||
|
|
4a7d5a6e54 | ||
|
|
50a0df0be4 | ||
|
|
cecebf6e86 | ||
|
|
ad4430706e | ||
|
|
93d4a373fb | ||
|
|
a9f51531d9 | ||
|
|
6bb98110b4 | ||
|
|
0b34aea202 | ||
|
|
f1e92d05d5 | ||
|
|
8ec2bcb89a | ||
|
|
beb87ef41f | ||
|
|
26a6def62f | ||
|
|
0fb597ef36 | ||
|
|
fe5dd9a61a | ||
|
|
bb9b0edcc5 | ||
|
|
f3176a664c | ||
|
|
1cbbe90a09 | ||
|
|
a9174f65ba | ||
|
|
2af2dd2350 | ||
|
|
9c77b8434a | ||
|
|
646794cbda | ||
|
|
93fdcf92e1 | ||
|
|
fbbd9514c5 | ||
|
|
be5c41b3c1 | ||
|
|
b853ee9f35 | ||
|
|
eb2625c4a7 | ||
|
|
e17f6cd23c | ||
|
|
54acd56b48 | ||
|
|
9bdd4b078a | ||
|
|
f5748da36c | ||
|
|
eade67b409 | ||
|
|
b3f62f79c2 | ||
|
|
9d133d5b69 | ||
|
|
9f003b5bf5 | ||
|
|
e688e20151 | ||
|
|
8749708115 | ||
|
|
5cc5d8d9b3 | ||
|
|
98b4119746 | ||
|
|
c889905e47 | ||
|
|
db54dadb46 | ||
|
|
604260f56e | ||
|
|
581a3ebc17 | ||
|
|
cc1acaba96 | ||
|
|
7b781ab6b6 | ||
|
|
233eb52a97 | ||
|
|
aff9743269 | ||
|
|
ce1d05fac5 | ||
|
|
6dad313734 | ||
|
|
5263e25548 | ||
|
|
39b8298390 | ||
|
|
57b80ea78a | ||
|
|
a5b7141fc4 | ||
|
|
9efb01da68 | ||
|
|
860c45ab2a | ||
|
|
8686edfc63 | ||
|
|
5e7a7c4738 | ||
|
|
928cc1146a | ||
|
|
d420afdacd | ||
|
|
f6015300a0 | ||
|
|
e183064744 | ||
|
|
40849c94ef | ||
|
|
4c1424f9bd | ||
|
|
0783f97fc0 | ||
|
|
e551885c24 | ||
|
|
4891a04258 | ||
|
|
ad77a9a75e | ||
|
|
5bf35a6b31 | ||
|
|
49044099dd | ||
|
|
7c423067a8 | ||
|
|
d08fa765b9 | ||
|
|
f47bcd8e3f | ||
|
|
873e79ec37 | ||
|
|
589b2ae85a | ||
|
|
f9f2b5f177 | ||
|
|
4157dc8a88 | ||
|
|
d0fc1456b7 | ||
|
|
86f70a7d9c | ||
|
|
f7b53f045d | ||
|
|
f3d140e363 | ||
|
|
93a1770f37 | ||
|
|
859a732509 | ||
|
|
eb778be64b | ||
|
|
2b2ae65182 | ||
|
|
e1b52d3676 | ||
|
|
ff4745b191 | ||
|
|
2ba694830d | ||
|
|
12c5c96ca2 | ||
|
|
a97af1fb97 | ||
|
|
5bf6a1e30c | ||
|
|
f8883cb700 | ||
|
|
f72ffe3c12 | ||
|
|
d2e896fbe1 | ||
|
|
a0b1799270 | ||
|
|
1d423ab2b9 | ||
|
|
7f5df4bf6e | ||
|
|
9f1fdc418d | ||
|
|
64cf4beb8a | ||
|
|
119174b7dd | ||
|
|
b3a7728299 | ||
|
|
2266a19900 | ||
|
|
1b587bee9a | ||
|
|
31b289adfe | ||
|
|
efadb34c84 | ||
|
|
58d63b4e5b | ||
|
|
0441a03bb9 | ||
|
|
90cb449ada | ||
|
|
a678d7baab | ||
|
|
2911bf33c9 | ||
|
|
221daf6e6a | ||
|
|
8f5a45f9e7 | ||
|
|
6f5fd80e0e | ||
|
|
1caeda0799 | ||
|
|
3fb33b8e47 | ||
|
|
e6288a7313 | ||
|
|
7dd7edff64 | ||
|
|
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 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,6 +1,12 @@
|
||||
*.sw?
|
||||
*.un?
|
||||
*.vba
|
||||
*.vmb
|
||||
*.zip
|
||||
*.gz
|
||||
vimball.txt
|
||||
*.orig
|
||||
tags
|
||||
test/build
|
||||
test/*.tap
|
||||
test/*.msgout
|
||||
|
||||
21
LICENSE.txt
Normal file
21
LICENSE.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Israel Chauca
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
75
Makefile
75
Makefile
@@ -1,70 +1,15 @@
|
||||
PLUGIN=$(shell basename "$$PWD")
|
||||
SCRIPT=$(wildcard plugin/*.vim)
|
||||
#AUTOL=$(wildcard autoload/*.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/
|
||||
VIM=/usr/bin/vim
|
||||
.DEFAULT: test
|
||||
|
||||
.PHONY: $(PLUGIN).vba README
|
||||
test_files := $(wildcard test/*.test)
|
||||
short_targets := $(patsubst test/%,%,$(test_files))
|
||||
|
||||
install: vimball
|
||||
@echo install
|
||||
$(VIM) -N -c ':so %' -c':q!' $(PLUGIN)-$(VERSION).vba
|
||||
cp -f $(TESTS) $(VIMFOLDER)$(TESTS)
|
||||
.PHONY: monitor test $(test_files) $(short_targets)
|
||||
|
||||
all: uninstall vimball install README zip gzip
|
||||
test:
|
||||
$(MAKE) -C test
|
||||
|
||||
vimball: $(PLUGIN).vba
|
||||
monitor:
|
||||
$(MAKE) -C test monitor
|
||||
|
||||
clean:
|
||||
@echo clean
|
||||
rm -f *.vba */*.orig *.~* .VimballRecord *.zip *.gz
|
||||
|
||||
dist-clean: clean
|
||||
|
||||
uninstall:
|
||||
@echo uninstall
|
||||
$(VIM) -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vba
|
||||
rm -f $(VIMFOLDER)$(TESTS)
|
||||
|
||||
undo:
|
||||
for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
|
||||
|
||||
README:
|
||||
@echo README
|
||||
cp -f $(DOC) README
|
||||
|
||||
$(PLUGIN).vba:
|
||||
@echo $(PLUGIN).vba
|
||||
rm -f $(PLUGIN)-$(VERSION).vba
|
||||
$(VIM) -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
|
||||
ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba
|
||||
|
||||
zip:
|
||||
@echo zip
|
||||
rm -f *.zip
|
||||
zip -r $(PLUGIN).zip doc plugin autoload
|
||||
zip $(PLUGIN).zip -d \*.sw\?
|
||||
zip $(PLUGIN).zip -d \*.orig
|
||||
zip $(PLUGIN).zip -d $(TESTS)
|
||||
ln -f $(PLUGIN).zip $(PLUGIN)-$(VERSION).zip
|
||||
|
||||
gzip: vimball
|
||||
@echo vimball
|
||||
gzip -f $(PLUGIN).vba
|
||||
|
||||
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 -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)
|
||||
@echo Version: $(VERSION)
|
||||
|
||||
echo:
|
||||
$(test_files) $(short_targets):
|
||||
$(MAKE) -C test $(patsubst test/%,%,$@)
|
||||
|
||||
646
README
646
README
@@ -1,646 +0,0 @@
|
||||
*delimitMate* Trying to keep those beasts at bay! v2.3 *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
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
0.- CONTENTS *delimitMate-contents*
|
||||
|
||||
1. Introduction____________________________|delimitMateIntro|
|
||||
2. Functionality___________________________|delimitMateFunctionality|
|
||||
2.1 Automatic closing & exiting________|delimitMateAutoClose|
|
||||
2.2 Expansion of space and CR__________|delimitMateExpansion|
|
||||
2.3 Backspace__________________________|delimitMateBackspace|
|
||||
2.4 Visual wrapping____________________|delimitMateVisualWrapping|
|
||||
2.5 Smart Quotes_______________________|delimitMateSmartQuotes|
|
||||
2.6 FileType based configuration_______|delimitMateFileType|
|
||||
2.7 Syntax awareness___________________|delimitMateSyntax|
|
||||
3. Customization___________________________|delimitMateOptions|
|
||||
3.1 Options summary____________________|delimitMateOptionSummary|
|
||||
3.2 Options details____________________|delimitMateOptionDetails|
|
||||
4. Commands________________________________|delimitMateCommands|
|
||||
5. Functions_______________________________|delimitMateFunctions|
|
||||
6. TODO list_______________________________|delimitMateTodo|
|
||||
7. Maintainer______________________________|delimitMateMaintainer|
|
||||
8. Credits_________________________________|delimitMateCredits|
|
||||
9. History_________________________________|delimitMateHistory|
|
||||
|
||||
==============================================================================
|
||||
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
|
||||
mode a little bit easier.
|
||||
|
||||
Most of the features can be modified or disabled permanently, using global
|
||||
variables, or on a FileType basis, using autocommands. With a couple of
|
||||
exceptions and limitations, this features don't brake undo, redo or history.
|
||||
|
||||
==============================================================================
|
||||
2. FUNCTIONALITY *delimitMateFunctionality*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.1 AUTOMATIC CLOSING AND EXITING *delimitMateAutoClose*
|
||||
|
||||
With automatic closing enabled, if an opening delimiter is inserted the plugin
|
||||
inserts the closing delimiter and places the cursor between the pair. With
|
||||
automatic closing disabled, no closing delimiters is inserted by delimitMate,
|
||||
but when a pair of delimiters is typed, the cursor is placed in the middle.
|
||||
|
||||
When the cursor is inside an empty pair or located next to the left of a
|
||||
closing delimiter, the cursor is placed outside the pair to the right of the
|
||||
closing delimiter.
|
||||
|
||||
Unless |'delimitMate_matchpairs'| or |'delimitMate_quotes'|are set, this
|
||||
script uses the values in '&matchpairs' to identify the pairs, and ", ' and `
|
||||
for quotes respectively.
|
||||
|
||||
The following table shows the behaviour, this applies to quotes too (the final
|
||||
position of the cursor is represented by a "|"):
|
||||
|
||||
With auto-close: >
|
||||
Type | You get
|
||||
====================
|
||||
( | (|)
|
||||
–––––––––|––––––––––
|
||||
() | ()|
|
||||
–––––––––|––––––––––
|
||||
(<S-Tab> | ()|
|
||||
<
|
||||
Without auto-close: >
|
||||
|
||||
Type | You get
|
||||
=====================
|
||||
() | (|)
|
||||
–––––––––-|––––––––––
|
||||
()) | ()|
|
||||
–––––––––-|––––––––––
|
||||
()<S-Tab> | ()|
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
|
||||
|
||||
When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be
|
||||
expanded, see |'delimitMate_expand_space'| and
|
||||
|'delimitMate_expand_cr'|:
|
||||
|
||||
Expand <Space> to: >
|
||||
|
||||
<Space><Space><Left> | You get
|
||||
====================================
|
||||
(|) | ( | )
|
||||
<
|
||||
Expand <CR> to: >
|
||||
|
||||
<CR><CR><Up> | You get
|
||||
============================
|
||||
(|) | (
|
||||
| |
|
||||
| )
|
||||
<
|
||||
|
||||
NOTE that the expansion of <CR> will brake the redo command.
|
||||
|
||||
Since <Space> and <CR> are used everywhere, I have made the functions involved
|
||||
in expansions global, so they can be used to make custom mappings. Read
|
||||
|delimitMateFunctions| for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.3 BACKSPACE *delimitMateBackspace*
|
||||
|
||||
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.
|
||||
|
||||
e.g. typing at the "|": >
|
||||
|
||||
What | Before | After
|
||||
==============================================
|
||||
<BS> | call expand(|) | call expand|
|
||||
---------|-------------------|-----------------
|
||||
<BS> | call expand( | ) | call expand(|)
|
||||
---------|-------------------|-----------------
|
||||
<BS> | call expand( | call expand(|)
|
||||
| | |
|
||||
| ) |
|
||||
---------|-------------------|-----------------
|
||||
<S-BS> | call expand(|) | call expand(|
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.4 WRAPPING OF VISUAL SELECTION *delimitMateVisualWrapping*
|
||||
|
||||
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 to fix this will be very welcome.
|
||||
|
||||
e.g. (selection represented between square brackets): >
|
||||
|
||||
Selected text | After \"
|
||||
=============================================
|
||||
An [absurd] example! | An "absurd" example!
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
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
|
||||
|'delimitMate_smart_quotes'| to 0.
|
||||
|
||||
e.g. typing at the "|": >
|
||||
|
||||
What | Before | After
|
||||
=======================================
|
||||
" | "String| | "String"|
|
||||
" | let i = "| | let i = "|"
|
||||
' | I| | I'|
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.6 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
|
||||
options for specific file types (see |'filetype'|) using buffer variables in
|
||||
the following way: >
|
||||
|
||||
au FileType mail,text let b:delimitMate_autoclose = 0
|
||||
^ ^ ^ ^ ^
|
||||
| | | | |
|
||||
| | | | - Option value.
|
||||
| | | - Option name.
|
||||
| | - Buffer variable.
|
||||
| - File types for which the option will be set.
|
||||
- Don't forget to put this event.
|
||||
<
|
||||
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.7 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*
|
||||
|
||||
You can create your own mappings for some features using the global functions.
|
||||
Read |DelimitMateFunctions| for more info.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.1 OPTIONS SUMMARY *delimitMateOptionSummary*
|
||||
|
||||
The behaviour of this script can be customized setting the following options
|
||||
in your vimrc file. You can use local options to set the configuration for
|
||||
specific file types, see |delimitMateOptionDetails| for examples.
|
||||
|
||||
|'loaded_delimitMate'| Turns off the script.
|
||||
|
||||
|'delimitMate_autoclose'| Tells delimitMate whether to automagically
|
||||
insert the closing delimiter.
|
||||
|
||||
|'delimitMate_matchpairs'| Tells delimitMate which characters are
|
||||
matching pairs.
|
||||
|
||||
|'delimitMate_quotes'| Tells delimitMate which quotes should be
|
||||
used.
|
||||
|
||||
|'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_excluded_ft'| Turns off the script for the given file types.
|
||||
|
||||
|'delimitMate_excluded_regions'|Turns off the script for the given regions or
|
||||
syntax group names.
|
||||
|
||||
|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
|
||||
balancing of single quotes when used as
|
||||
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*
|
||||
|
||||
Add the shown lines to your vimrc file in order to set the below options.
|
||||
Buffer variables take precedence over global ones and can be used along with
|
||||
autocmd to modify delimitMate's behavior for specific file types, read more in
|
||||
|delimitMateFileType|.
|
||||
|
||||
Note: Use buffer variables only to set options for specific file types using
|
||||
:autocmd, use global variables to set options for every buffer. Read more in
|
||||
|g:var| and |b:var|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'loaded_delimitMate'*
|
||||
*'b:loaded_delimitMate'*
|
||||
This option prevents delimitMate from loading.
|
||||
e.g.: >
|
||||
let loaded_delimitMate = 1
|
||||
au FileType mail let b:loaded_delimitMate = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_autoclose'*
|
||||
*'b:delimitMate_autoclose'*
|
||||
Values: 0 or 1. ~
|
||||
Default: 1 ~
|
||||
|
||||
If this option is set to 0, delimitMate will not add a closing delimiter
|
||||
automagically. See |delimitMateAutoClose| for details.
|
||||
e.g.: >
|
||||
let delimitMate_autoclose = 0
|
||||
au FileType mail let b:delimitMate_autoclose = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_matchpairs'*
|
||||
*'b:delimitMate_matchpairs'*
|
||||
Values: A string with |matchpairs| syntax. ~
|
||||
Default: &matchpairs ~
|
||||
|
||||
Use this option to tell delimitMate which characters should be considered
|
||||
matching pairs. Read |delimitMateAutoClose| for details.
|
||||
e.g: >
|
||||
let delimitMate_matchpairs = "(:),[:],{:},<:>"
|
||||
au FileType vim,html let b:delimitMate_matchpairs = "(:),[:],{:},<:>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_quotes'*
|
||||
*'b:delimitMate_quotes'*
|
||||
Values: A string of characters separated by spaces. ~
|
||||
Default: "\" ' `" ~
|
||||
|
||||
Use this option to tell delimitMate which characters should be considered as
|
||||
quotes. Read |delimitMateAutoClose| for details.
|
||||
e.g.: >
|
||||
let b:delimitMate_quotes = "\" ' ` *"
|
||||
au FileType html let b:delimitMate_quotes = "\" '"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_visual_leader'*
|
||||
*'b:delimitMate_visual_leader'*
|
||||
Values: Any character. ~
|
||||
Default: q ~
|
||||
|
||||
The value of this option will be used to wrap the selection in visual mode
|
||||
when followed by a delimiter. Read |delimitMateVisualWrap| for details.
|
||||
e.g: >
|
||||
let delimitMate_visual_leader = "f"
|
||||
au FileType html let b:delimitMate_visual_leader = "f"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_expand_cr'*
|
||||
*'b:delimitMate_expand_cr'*
|
||||
Values: 1 or 0 ~
|
||||
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>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_expand_space'*
|
||||
*'b:delimitMate_expand_space'*
|
||||
Values: A key mapping. ~
|
||||
Default: "\<Space>" ~
|
||||
|
||||
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>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_excluded_ft'*
|
||||
Values: A string of file type names separated by single commas. ~
|
||||
Default: Empty. ~
|
||||
|
||||
This options turns delimitMate off for the listed file types, use this option
|
||||
only if you don't want any of the features it provides on those file types.
|
||||
e.g.: >
|
||||
let delimitMate_excluded_ft = "mail,txt"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'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_apostrophes'*
|
||||
Values: Strings separated by ":". ~
|
||||
Default: No longer used. ~
|
||||
|
||||
NOTE: This feature is turned off by default, it's been kept for compatibility
|
||||
with older version, read |delimitMateSmartQuotes| for details.
|
||||
If auto-close is enabled, this option tells delimitMate how to try to fix the
|
||||
balancing of single quotes when used as apostrophes. The values of this option
|
||||
are strings of text where a single quote would be used as an apostrophe (e.g.:
|
||||
the "n't" of wouldn't or can't) separated by ":". Set it to an empty string to
|
||||
disable this feature.
|
||||
e.g.: >
|
||||
let delimitMate_apostrophes = ""
|
||||
au FileType tcl let delimitMate_apostrophes = ""
|
||||
<
|
||||
==============================================================================
|
||||
4. COMMANDS *delimitMateCommands*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
:DelimitMateReload *:DelimitMateReload*
|
||||
|
||||
Re-sets all the mappings used for this script, use it if any option has been
|
||||
changed or if the filetype option hasn't been set yet.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
:DelimitMateSwitch *:DelimitMateSwitch*
|
||||
|
||||
Switches the plug-in on and off.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
:DelimitMateTest *:DelimitMateTest*
|
||||
|
||||
This command tests every mapping set-up for this script, useful for testing
|
||||
custom configurations.
|
||||
|
||||
The following output corresponds to the default values, it will be different
|
||||
depending on your configuration. "Open & close:" represents the final result
|
||||
when the closing delimiter has been inserted, either manually or
|
||||
automatically, see |delimitMateExpansion|. "Delete:" typing backspace in an
|
||||
empty pair, see |delimitMateBackspace|. "Exit:" typing a closing delimiter
|
||||
inside a pair of delimiters, see |delimitMateAutoclose|. "Space:" the
|
||||
expansion, if any, of space, see |delimitMateExpansion|. "Visual-L",
|
||||
"Visual-R" and "Visual" shows visual wrapping, see
|
||||
|delimitMateVisualWrapping|. "Car return:" the expansion of car return, see
|
||||
|delimitMateExpansion|. The cursor's position at the end of every test is
|
||||
represented by an "|": >
|
||||
|
||||
* AUTOCLOSE:
|
||||
Open & close: (|)
|
||||
Delete: |
|
||||
Exit: ()|
|
||||
Space: ( |)
|
||||
Visual-L: (v)
|
||||
Visual-R: (v)
|
||||
Car return: (
|
||||
|)
|
||||
|
||||
Open & close: {|}
|
||||
Delete: |
|
||||
Exit: {}|
|
||||
Space: { |}
|
||||
Visual-L: {v}
|
||||
Visual-R: {v}
|
||||
Car return: {
|
||||
|}
|
||||
|
||||
Open & close: [|]
|
||||
Delete: |
|
||||
Exit: []|
|
||||
Space: [ |]
|
||||
Visual-L: [v]
|
||||
Visual-R: [v]
|
||||
Car return: [
|
||||
|]
|
||||
|
||||
Open & close: "|"
|
||||
Delete: |
|
||||
Exit: ""|
|
||||
Space: " |"
|
||||
Visual: "v"
|
||||
Car return: "
|
||||
|"
|
||||
|
||||
Open & close: '|'
|
||||
Delete: |
|
||||
Exit: ''|
|
||||
Space: ' |'
|
||||
Visual: 'v'
|
||||
Car return: '
|
||||
|'
|
||||
|
||||
Open & close: `|`
|
||||
Delete: |
|
||||
Exit: ``|
|
||||
Space: ` |`
|
||||
Visual: `v`
|
||||
Car return: `
|
||||
|`
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
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*
|
||||
|
||||
Returns 1 if the cursor is inside an empty pair, 0 otherwise.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
delimitMate#ExpandReturn() *delimitMate#ExpandReturn()*
|
||||
|
||||
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>" :
|
||||
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
delimitMate#ExpandSpace() *delimitMate#ExpandSpace()*
|
||||
|
||||
Returns the expansion for <Space> if enabled and inside an empty pair, returns
|
||||
<Space> otherwise.
|
||||
e.g.: >
|
||||
|
||||
inoremap <Space> <C-R>=delimitMate#ExpandSpace()<CR>
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
delimitMate#ShouldJump() *delimitMate#ShouldJump()*
|
||||
|
||||
Returns 1 if there is a closing delimiter or a quote to the right of the
|
||||
cursor, 0 otherwise.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
delimitMate#JumpAny(key) *delimitMate#JumpAny()*
|
||||
|
||||
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 <C-Tab> <C-R>=delimitMate#JumpAny("\<S-Tab>")<CR>
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
6. TODO LIST *delimitMateTodo*
|
||||
|
||||
- Automatic set-up by file type.
|
||||
- Make visual wrapping work on blockwise visual mode.
|
||||
|
||||
==============================================================================
|
||||
7. MAINTAINER *delimitMateMaintainer*
|
||||
|
||||
Hi there! My name is Israel Chauca F. and I can be reached at:
|
||||
mailto:israelchauca@gmail.com
|
||||
|
||||
Feel free to send me any suggestions and/or comments about this plugin, I'll
|
||||
be very pleased to read them.
|
||||
|
||||
==============================================================================
|
||||
8. CREDITS *delimitMateCredits*
|
||||
|
||||
Some of the code that make this script is modified or just shamelessly copied
|
||||
from the following sources:
|
||||
|
||||
- Ian McCracken
|
||||
Post titled: Vim, Part II: Matching Pairs:
|
||||
http://concisionandconcinnity.blogspot.com/
|
||||
|
||||
- Aristotle Pagaltzis
|
||||
From the comments on the previous blog post and from:
|
||||
http://gist.github.com/144619
|
||||
|
||||
- Vim Scripts:
|
||||
http://www.vim.org/scripts
|
||||
|
||||
This script was inspired by the auto-completion of delimiters of TextMate.
|
||||
|
||||
==============================================================================
|
||||
9. HISTORY *delimitMateHistory*
|
||||
|
||||
Version Date Release notes ~
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
2.3 2010-06-06 * Current release:
|
||||
- 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.
|
||||
- A single quote typed after an alphanumeric
|
||||
character is considered an apostrophe and one
|
||||
single quote is inserted.
|
||||
- A quote typed after another quote inserts a single
|
||||
quote and the cursor jumps to the middle.
|
||||
- <S-Tab> jumps out of any empty pair.
|
||||
- <CR> and <Space> expansions are fixed, but the
|
||||
functions used for it are global and can be used in
|
||||
custom mappings. The previous system is still
|
||||
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.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.6 2009-10-10 * Now delimitMate tries to fix the balancing of single
|
||||
quotes when used as apostrophes. You can read
|
||||
|delimitMate_apostrophes| for details.
|
||||
Fixed an error when |b:delimitMate_expand_space|
|
||||
wasn't set but |delimitMate_expand_space| wasn't.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.5 2009-10-05 * Fix: delimitMate should work correctly for files
|
||||
passed as arguments to Vim. Thanks to Ben Beuchler
|
||||
for helping to nail this bug.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.4 2009-09-27 * Fix: delimitMate is now enabled on new buffers even
|
||||
if they don't have set the file type option or were
|
||||
opened directly from the terminal.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.3 2009-09-24 * Now local options can be used along with autocmd
|
||||
for specific file type configurations.
|
||||
Fixes:
|
||||
- Unnamed register content is not lost on visual
|
||||
mode.
|
||||
- Use noremap where appropiate.
|
||||
- Wrapping a single empty line works as expected.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.2 2009-09-07 * Fixes:
|
||||
- When inside nested empty pairs, deleting the
|
||||
innermost left delimiter would delete all right
|
||||
contiguous delimiters.
|
||||
- When inside an empty pair, inserting a left
|
||||
delimiter wouldn't insert the right one, instead
|
||||
the cursor would jump to the right.
|
||||
- New buffer inside the current window wouldn't
|
||||
have the mappings set.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.1 2009-08-25 * Fixed an error that ocurred when mapleader wasn't
|
||||
set and added support for GetLatestScripts
|
||||
auto-detection.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.0 2009-08-23 * Initial upload.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
|
||||
|
||||
`\|||/´ 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:
|
||||
6
README.md
Normal file
6
README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
This plug-in provides automatic closing of quotes, parenthesis, brackets, etc., besides some other related features that
|
||||
should make your time in insert mode a little bit easier, like syntax awareness (will not insert the closing delimiter
|
||||
in comments and other configurable regions), <CR> and <Space> expansions (off by default), and some more.
|
||||
|
||||
Most of the features can be modified or disabled permanently, using global variables, or on a FileType basis, using
|
||||
:autocmd.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,272 +0,0 @@
|
||||
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
|
||||
endif
|
||||
nmap <F1> :qall!<CR>
|
||||
let b:test_results = {}
|
||||
let b:errors = 0
|
||||
let b:corrects = 0
|
||||
let b:ignores = 0
|
||||
|
||||
function! SetOptions(list) " {{{
|
||||
let b:delimitMate_autoclose = 1
|
||||
let b:delimitMate_matchpairs = &matchpairs
|
||||
let b:delimitMate_quotes = "\" ' `"
|
||||
let b:delimitMate_excluded_regions = "Comment"
|
||||
silent! unlet b:delimitMate_visual_leader
|
||||
let b:delimitMate_expand_space = 0
|
||||
let b:delimitMate_expand_cr = 0
|
||||
let b:delimitMate_smart_quotes = 1
|
||||
let b:delimitMate_apostrophes = ""
|
||||
let b:delimitMate_tab2exit = 1
|
||||
" Set current test options:
|
||||
for str in a:list
|
||||
let pair = split(str, ':')
|
||||
exec "let b:delimitMate_" . pair[0] . " = " . pair[1]
|
||||
endfor
|
||||
DelimitMateReload
|
||||
endfunction " }}}
|
||||
|
||||
function! Type(name, input, output, options, ...) " {{{
|
||||
if a:0 > 0
|
||||
let ignore = a:1
|
||||
else
|
||||
let ignore = 0
|
||||
endif
|
||||
if a:input != "\<Esc>."
|
||||
" Set default options:
|
||||
call SetOptions(a:options)
|
||||
let CapR = ""
|
||||
normal ggVG"_d
|
||||
exec "normal i" . a:input . "|\<Esc>"
|
||||
else
|
||||
let CapR = "_R"
|
||||
normal gg.
|
||||
endif
|
||||
|
||||
call setpos('.', [0, 1, 1, 0])
|
||||
let result = len(a:output) != line('$')
|
||||
for line in a:output
|
||||
if getline('.') != line || result == 1
|
||||
let result = 1
|
||||
break
|
||||
endif
|
||||
call setpos('.', [0, line('.') + 1, 1, 0])
|
||||
endfor
|
||||
let text = getline('.')
|
||||
let i = 2
|
||||
while i <= line('$')
|
||||
let text = text . "<cr>" . getline(i)
|
||||
let i += 1
|
||||
endwhile
|
||||
if ignore == 1
|
||||
let label = "Ignored"
|
||||
let result = "?="
|
||||
let b:ignores += 1
|
||||
elseif result == 0
|
||||
let label = "Passed"
|
||||
let result = "=="
|
||||
let b:corrects += 1
|
||||
else
|
||||
let label = "Failed"
|
||||
let result = "!="
|
||||
let b:errors += 1
|
||||
endif
|
||||
exec "let b:test_results['" .
|
||||
\ substitute(a:name, "[^a-zA-Z0-9_]", "_", "g") . CapR . "'] = '" .
|
||||
\ label . ": ' . a:input . ' => ' . text . ' " .
|
||||
\ result . " ' . join(a:output, '<cr>')"
|
||||
endfunction " }}}
|
||||
|
||||
function! RepeatLast(name, output, ...) " {{{
|
||||
if a:0 > 0
|
||||
let arg1 = a:1
|
||||
else
|
||||
let arg1 = ''
|
||||
endif
|
||||
call Type(a:name, "\<Esc>.", a:output, [], arg1)
|
||||
endfunction " }}}
|
||||
|
||||
" Test's test {{{
|
||||
call Type("Test 1", "123", ["123|"], [])
|
||||
call RepeatLast("Test 1", ["123|123|"])
|
||||
|
||||
" Auto-closing parens
|
||||
call Type("Autoclose parens", "(", ["(|)"], [])
|
||||
call RepeatLast("Autoclose_parens", ["(|)(|)"])
|
||||
|
||||
" Auto-closing quotes
|
||||
call Type("Autoclose quotes", '"', ['"|"'], [])
|
||||
call RepeatLast("Autoclose_quotes", ['"|""|"'])
|
||||
|
||||
" Deleting parens
|
||||
call Type("Delete empty parens", "(\<BS>", ["|"], [])
|
||||
call RepeatLast("Delete empty parens", ["||"])
|
||||
|
||||
" Deleting quotes
|
||||
call Type("Delete emtpy quotes", "\"\<BS>", ['|'], [])
|
||||
call RepeatLast("Delete empty quotes", ["||"])
|
||||
|
||||
" Manual closing parens
|
||||
call Type("Manual closing parens", "()", ["(|)"], ["autoclose:0"])
|
||||
call RepeatLast("Manual closing parens", ["(|)(|)"])
|
||||
|
||||
" Manual closing quotes
|
||||
call Type("Manual closing quotes", "\"\"", ['"|"'], ["autoclose:0"])
|
||||
call RepeatLast("Manual closing quotes", ['"|""|"'])
|
||||
|
||||
" Jump over paren
|
||||
call Type("Jump over paren", "()", ['()|'], [])
|
||||
call RepeatLast("Jump over paren", ['()|()|'])
|
||||
|
||||
" Jump over quote
|
||||
call Type("Jump over quote", "\"\"", ['""|'], [])
|
||||
call RepeatLast("Jump over quote", ['""|""|'])
|
||||
|
||||
" Apostrophe
|
||||
call Type("Apostrophe", "test'", ["test'|"], [])
|
||||
call RepeatLast("Apostrophe", ["test'|test'|"])
|
||||
|
||||
" Close quote
|
||||
call Type("Close quote", "'\<Del>\<Esc>a'", ["'|'"], [])
|
||||
|
||||
" Closing paren
|
||||
call Type("Closing paren", "abcd)", ["abcd)|"], [])
|
||||
|
||||
" <S-Tab>
|
||||
call Type("S Tab", "(\<S-Tab>", ["()|"], [])
|
||||
call RepeatLast("S Tab", ["()|()|"])
|
||||
|
||||
" Space expansion
|
||||
call Type("Space expansion", "(\<Space>\<BS>", ['(|)'], ['expand_space:1'])
|
||||
call RepeatLast("BS with space expansion", ['(|)(|)'])
|
||||
|
||||
" BS with space expansion
|
||||
call Type("BS with space expansion", "(\<Space>", ['( | )'], ['expand_space:1'])
|
||||
call RepeatLast("Space expansion", ['( | )( | )'])
|
||||
|
||||
" Car return expansion
|
||||
call Type("CR expansion", "(\<CR>", ['(', '|', ')'], ['expand_cr:1'])
|
||||
call RepeatLast("CR expansion", ['(', '|', ')(', '|', ')'], 1)
|
||||
|
||||
" BS with car return expansion
|
||||
call Type("BS with CR expansion", "(\<CR>\<BS>", ['(|)'], ['expand_cr:1'])
|
||||
call RepeatLast("BS with CR expansion", ['(|)(|)'], 1)
|
||||
|
||||
" Visual wrapping
|
||||
call Type("Visual wrapping left paren", "1234\<Esc>v,(", ['123(4)'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual wrapping left paren", ['(1)23(4)'], 1)
|
||||
|
||||
" Visual line wrapping
|
||||
call Type("Visual line wrapping left paren", "1234\<Esc>V,(", ['(1234)'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual line wrapping left paren", ['((1234))'], 1)
|
||||
|
||||
" Visual wrapping
|
||||
call Type("Visual wrapping right paren", "1234\<Esc>v,)", ['123(4)'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual wrapping right paren", ['(1)23(4)'], 1)
|
||||
|
||||
" Visual line wrapping
|
||||
call Type("Visual line wrapping right paren", "1234\<Esc>V,)", ['(1234)'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual line wrapping right paren", ['((1234))'], 1)
|
||||
|
||||
" Visual wrapping
|
||||
call Type("Visual wrapping quote", "1234\<Esc>v,\"", ['123"4"'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual wrapping quote", ['"1"23"4"'], 1)
|
||||
|
||||
" Visual line wrapping
|
||||
call Type("Visual line wrapping quote", "1234\<Esc>V,\"", ['"1234"'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual line wrapping quote", ['""1234""'], 1)
|
||||
|
||||
" Visual line wrapping empty line
|
||||
call Type("Visual line wrapping paren empty line", "\<Esc>V,(", ['()'], ['visual_leader:","'])
|
||||
|
||||
" Visual line wrapping empty line
|
||||
call Type("Visual line wrapping quote empty line", "\<Esc>V,\"", ['""'], ['visual_leader:","'])
|
||||
|
||||
" Smart quotes
|
||||
call Type("Smart quote alphanumeric", "a\"4", ['a"4|'], [])
|
||||
call RepeatLast("Smart quote alphanumeric", ['a"4|a"4|'])
|
||||
|
||||
" Smart quotes
|
||||
call Type("Smart quote escaped", "esc\\\"", ['esc\"|'], [])
|
||||
call RepeatLast("Smart quote escaped", ['esc\"|esc\"|'])
|
||||
|
||||
" Smart quotes
|
||||
call Type("Smart quote apostrophe", "I'm", ["I'm|"], ['smart_quotes:0'])
|
||||
call RepeatLast("Smart quote escaped", ["I'm|I'm|"])
|
||||
|
||||
" Backspace inside space expansion
|
||||
call Type("Backspace inside space expansion", "(\<Space>\<BS>", ['(|)'], ['expand_space:1'])
|
||||
call RepeatLast("Backspace inside space expansion", ['(|)(|)'])
|
||||
|
||||
" <Right-arrow> inserts text
|
||||
call Type("<Right-arrow> inserts text", "(he\<Right>\<Space>th\<Right>\<Right>", ['(he) th|'], [])
|
||||
|
||||
" Backspace inside CR expansion
|
||||
call Type("Backspace inside CR expansion", "(\<CR>\<BS>", ['(|)'], ['expand_cr:1'])
|
||||
call RepeatLast("Backspace inside CR expansion", ['(|)(|)'], 1)
|
||||
|
||||
" FileType event
|
||||
let g:delimitMate_excluded_ft = "vim"
|
||||
set ft=vim
|
||||
call Type("FileType Autoclose parens", "(", ["(|"], [])
|
||||
unlet g:delimitMate_excluded_ft
|
||||
set ft=
|
||||
|
||||
" Duplicated delimiter after CR
|
||||
call Type("Duplicated delimiter after CR", "(\<CR>", ['(', '|)'], [])
|
||||
|
||||
" Deactivate 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 on comments", "\"()``[]''\"\"", ["\"()``[]''\"\"|"], ["autoclose:0"], 1)
|
||||
set ft=
|
||||
|
||||
" 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)
|
||||
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
|
||||
call Type("Manual close at start of line", "m)\<Left>\<Left>)", [')|m)'], ["autoclose:0"])
|
||||
|
||||
"}}}
|
||||
|
||||
" Show results: {{{
|
||||
normal ggVG"_d
|
||||
call append(0, split(string(b:test_results)[1:-2], ', '))
|
||||
call append(0, "*TESTS REPORT: " . b:errors . " failed, " . b:corrects . " passed and " . b:ignores . " ignored.")
|
||||
normal "_ddgg
|
||||
let @/ = ".\\+Failed:.*!="
|
||||
set nohlsearch
|
||||
"syntax match failedLine "^.*Failed.*$" contains=ALL
|
||||
"syn match passedLine ".*Passed.*"
|
||||
syn match lineIgnored ".*Ignored.*"
|
||||
syn match labelPassed "'\@<=.\+\(': 'Passed\)\@="
|
||||
syn match labelFailed "'\@<=.\+\(': 'Failed\)\@="
|
||||
syn match resultPassed "\('Passed: \)\@<=.\+\('$\)\@="
|
||||
syn match resultFailed "\('Failed: \)\@<=.\+\('$\)\@=" contains=resultInequal
|
||||
syn match resultIgnored "\('Ignored: \)\@<=.\+\('$\)\@="
|
||||
syn match resultInequal "!="
|
||||
syn match resultSummary "^\*.\+" contains=resultSummaryNumber
|
||||
syn match resultSummaryNumber "[1-9][0-9]* failed*" contained
|
||||
|
||||
hi def link lineIgnored Ignore
|
||||
hi def link labelPassed Comment
|
||||
hi def link labelFailed Special
|
||||
hi def link resultPassed Ignore
|
||||
hi def link resultFailed Boolean
|
||||
hi def link resultInequal Error
|
||||
hi def link resultSummary SpecialComment
|
||||
hi def link resultSummaryNumber Error
|
||||
" }}}
|
||||
endfunction " }}}
|
||||
" vim:foldmethod=marker:foldcolumn=4
|
||||
|
||||
4
basic_vimrc
Normal file
4
basic_vimrc
Normal file
@@ -0,0 +1,4 @@
|
||||
so ./test/_setup.vim
|
||||
let delimitMate_expand_cr = 1
|
||||
filetype indent plugin on
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,119 +1,22 @@
|
||||
" ============================================================================
|
||||
" File: plugin/delimitMate.vim
|
||||
" Version: 2.3
|
||||
" Modified: 2010-06-06
|
||||
" 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!
|
||||
finish
|
||||
if exists("g:loaded_delimitMate") || &cp || !exists('##InsertCharPre')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_delimitMate = 1
|
||||
let save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists("s:loaded_delimitMate") && !exists("g:delimitMate_testing")
|
||||
" Don't define the functions if they already exist: just do the work
|
||||
" (unless we are testing):
|
||||
call s:DelimitMateDo()
|
||||
finish
|
||||
endif
|
||||
command! -bar -bang DelimitMateSwitch call delimitMate#ex_cmd(<bang>0, 'switch' )
|
||||
command! -bar -bang DelimitMateOn call delimitMate#ex_cmd(<bang>0, 'enable' )
|
||||
command! -bar -bang DelimitMateOff call delimitMate#ex_cmd(<bang>0, 'disable')
|
||||
|
||||
if v:version < 700
|
||||
echoerr "delimitMate: this plugin requires vim >= 7!"
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:loaded_delimitMate = 1 " }}}
|
||||
let delimitMate_version = '2.3'
|
||||
|
||||
"}}}
|
||||
|
||||
" Tools: {{{
|
||||
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]
|
||||
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#TestMappings()
|
||||
exec "normal i\<CR>"
|
||||
endfor
|
||||
endfor
|
||||
let b:delimitMate_expand_space = temp_varsDM[0]
|
||||
let b:delimitMate_expand_cr = temp_varsDM[1]
|
||||
let b:delimitMate_autoclose = temp_varsDM[2]
|
||||
unlet temp_varsDM
|
||||
endif
|
||||
normal gg
|
||||
endfunction "}}}
|
||||
|
||||
function! s:DelimitMateDo() "{{{
|
||||
if exists("g:delimitMate_excluded_ft")
|
||||
" Check if this file type is excluded:
|
||||
for ft in split(g:delimitMate_excluded_ft,',')
|
||||
if ft ==? &filetype
|
||||
"echomsg "excluded"
|
||||
call delimitMate#UnMap()
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
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()
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
"}}}
|
||||
|
||||
" Commands: {{{
|
||||
call s:DelimitMateDo()
|
||||
|
||||
" Let me refresh without re-loading the buffer:
|
||||
command! DelimitMateReload call s:DelimitMateDo()
|
||||
|
||||
" Quick test:
|
||||
command! DelimitMateTest call s:TestMappingsDo()
|
||||
|
||||
" Switch On/Off:
|
||||
command! DelimitMateSwitch call s:DelimitMateSwitch()
|
||||
|
||||
" Run on file type events.
|
||||
"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
|
||||
|
||||
" Flush the char buffer:
|
||||
autocmd InsertEnter * call delimitMate#FlushBuffer()
|
||||
autocmd BufEnter * if mode() == 'i' | call delimitMate#FlushBuffer() | endif
|
||||
|
||||
"function! s:GetSynRegion () | echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') | endfunction
|
||||
|
||||
"}}}
|
||||
augroup delimitMate
|
||||
au!
|
||||
au InsertCharPre * call delimitMate#InsertCharPre(v:char)
|
||||
au TextChangedI * call delimitMate#TextChangedI()
|
||||
au InsertEnter * call delimitMate#InsertEnter()
|
||||
au CursorMovedI * call delimitMate#CursorMovedI()
|
||||
augroup END
|
||||
|
||||
let &cpo = save_cpo
|
||||
" GetLatestVimScripts: 2754 1 :AutoInstall: delimitMate.vim
|
||||
" vim:foldmethod=marker:foldcolumn=4
|
||||
" vim: sw=2 et
|
||||
|
||||
14
test/Makefile
Normal file
14
test/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
test_files := $(wildcard *.test)
|
||||
|
||||
.PHONY: all monitor $(test_files)
|
||||
|
||||
all:
|
||||
time tclsh all.tcl
|
||||
|
||||
$(test_files):
|
||||
time tclsh $@
|
||||
printf "\a"
|
||||
|
||||
monitor:
|
||||
fswatch -o ../autoload/*.vim ../plugin/*.vim *.test \
|
||||
| xargs -n1 -I\{\} time tclsh all.tcl || printf "\a"
|
||||
18
test/README.md
Normal file
18
test/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Automatic test setup
|
||||
You can use `make` (or `make test` from the top level directory) to run the
|
||||
tests.
|
||||
|
||||
# Manual test setup instructions
|
||||
The plugins [runVimTests](http://www.vim.org/scripts/script.php?script_id=2565)
|
||||
and [VimTAP](http://www.vim.org/scripts/script.php?script_id=2213) are needed
|
||||
to run these tests.
|
||||
|
||||
Besides the `_setup.vim` configuration file present in this repo you need to
|
||||
create a global one and place it in the same dir where the runVimTests
|
||||
executable is located. Assuming the executable is at '~/bin/runVimTests' this
|
||||
global configuration file should be '~/bin/runVimTestsSetup.vim' and should
|
||||
have something like the following lines inside of it:
|
||||
|
||||
" Prepend tests repos to &rtp
|
||||
let &runtimepath = '/path/to/runVimTests_dir,' . &rtp
|
||||
let &runtimepath = '/path/to/vimTAP_dir,' . &rtp
|
||||
11
test/_setup.vim
Normal file
11
test/_setup.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
set bs=2
|
||||
set hidden
|
||||
set noshowmode
|
||||
set whichwrap=[]
|
||||
set noswapfile
|
||||
let &hl = join(map(split(&hl, ','), 'substitute(v:val, '':.\+'', ''n'', ''g'')'), ',')
|
||||
let &rtp = expand('<sfile>:p:h:h') . ',' . &rtp . ',' . expand('<sfile>:p:h:h') . '/after'
|
||||
let g:delimitMate_pairs = ['()','{}','[]','<>','¿?','¡!',',:']
|
||||
let g:delimitMate_quotes = ['"', "'", '`', '«', '|']
|
||||
ru plugin/delimitMate.vim
|
||||
au VimEnter * echom 'Start test'
|
||||
18
test/all.tcl
Normal file
18
test/all.tcl
Normal file
@@ -0,0 +1,18 @@
|
||||
package require tcltest 2
|
||||
namespace import -force ::tcltest::*
|
||||
configure {*}$argv -testdir [file dir [info script]]
|
||||
|
||||
# Hook to determine if any of the tests failed. Then we can exit with
|
||||
# proper exit code: 0=all passed, 1=one or more failed
|
||||
proc tcltest::cleanupTestsHook {} {
|
||||
variable numTests
|
||||
upvar 2 testFileFailures crashed
|
||||
set ::exitCode [expr {$numTests(Failed) > 0}]
|
||||
if {[info exists crashed]} {
|
||||
set ::exitCode [expr {$::exitCode || [llength $crashed]}]
|
||||
}
|
||||
}
|
||||
|
||||
runAllTests
|
||||
puts "\a"
|
||||
exit $exitCode
|
||||
49
test/eol_marker.test
Normal file
49
test/eol_marker.test
Normal file
@@ -0,0 +1,49 @@
|
||||
# singleTest name desc setup input result vimCmds? skipScript?
|
||||
#
|
||||
# - desc can be empty and input would be used.
|
||||
# - vimCmds is a list of ex commands.
|
||||
# - skipScript will be evaluated in the scope of the function "single" and it
|
||||
# should return a keywowd such as toDo, badTest or other as listed in the
|
||||
# docs for tcltest. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
# Get some help:
|
||||
source helper.tcl
|
||||
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {let g:delimitMate_eol_marker = ';'}
|
||||
lappend vimCmds {let g:delimitMate_insert_eol_marker = 0}
|
||||
|
||||
single ins_eol_marker_0-1 {} "" "i(" "()" ${vimCmds}
|
||||
|
||||
single ins_eol_marker_0-2 {} "" "i(\rx" "(\nx\n)" ${vimCmds}
|
||||
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {let g:delimitMate_eol_marker = ';'}
|
||||
lappend vimCmds {let g:delimitMate_insert_eol_marker = 1}
|
||||
single ins_eol_marker_1-1 {} "" "i(" "();" ${vimCmds}
|
||||
|
||||
single ins_eol_marker_1-2 {} " a" "0i(" "() a" ${vimCmds}
|
||||
|
||||
single ins_eol_marker_1-3 {} "" "i(\rx" "(\nx\n);" ${vimCmds}
|
||||
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {let g:delimitMate_eol_marker = ';'}
|
||||
lappend vimCmds {let g:delimitMate_insert_eol_marker = 2}
|
||||
single ins_eol_marker_2-1 {} "" "i(" "()" ${vimCmds}
|
||||
|
||||
single ins_eol_marker_2-2 {} "" "i(\rx" "(\nx\n);" ${vimCmds}
|
||||
|
||||
# Issue #195
|
||||
single issue_195-1 {} "" "i{(\rx" "{(\nx\n)}" ${vimCmds}
|
||||
|
||||
# Issue #195
|
||||
single issue_195-2 {} ";" "I{(\rx" "{(\nx\n)};" ${vimCmds}
|
||||
|
||||
|
||||
|
||||
################################################################
|
||||
# This gives nice statistics and cleans up the mess left behind.
|
||||
cleanupTests
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
92
test/expand_cr.test
Normal file
92
test/expand_cr.test
Normal file
@@ -0,0 +1,92 @@
|
||||
# singleTest name desc setup input result vimCmds? skipScript?
|
||||
#
|
||||
# - desc can be empty and input would be used.
|
||||
# - vimCmds is a list of ex commands.
|
||||
# - skipScript will be evaluated in the scope of the function "single" and it
|
||||
# should return a keywowd such as toDo, badTest or other as listed in the
|
||||
# docs for tcltest. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
# Get some help:
|
||||
source helper.tcl
|
||||
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
#"let g:delimitMate_eol_marker = ';'
|
||||
lappend vimCmds {filetype indent on}
|
||||
lappend vimCmds {set bs=2 et sts=4 sw=4 ft=javascript}
|
||||
single javascript-1 {} "\$(document).ready(function() {})" "f{a\rx" \
|
||||
"\$(document).ready(function() {\n x\n})" ${vimCmds}
|
||||
|
||||
# Issue #95
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {let b:delimitMate_jump_expansion = 1}
|
||||
set skipScript {string cat toDo}
|
||||
single issue_95 {} "" "i(\rtest)x" "(\ntest\n)x" ${vimCmds} ${skipScript}
|
||||
|
||||
# Remove CR expansion on BS
|
||||
set skipScript {string cat toDo}
|
||||
single bs {} "" "i(\r\bx" "(x)" ${vimCmds} ${skipScript}
|
||||
|
||||
# Consider indentation with BS inside an empty CR expansion.
|
||||
single bs_indentation {} "" "i( \r\b\bx" "(x)" ${vimCmds}
|
||||
|
||||
# Conflict with indentation settings (cindent). Issue #95
|
||||
lappend vimCmds {se cindent}
|
||||
single issue_95 {} "sub foo {\n while (1) {\n\n }\n}" "3Gi\bx" \
|
||||
"sub foo {\n while (1) {x}\n}" ${vimCmds}
|
||||
|
||||
single nested_expansion-1 {} "sub foo {\n while (1) {\n bar\n }\n}" \
|
||||
"3GA}x" "sub foo {\n while (1) {\n bar\n }x\n}" ${vimCmds}
|
||||
|
||||
single nested_expansion-2 {} "sub foo {\n while (1) {\n bar\n }\n}" \
|
||||
"3GA{x" "sub foo {\n while (1) {\n bar{x}\n }\n}" ${vimCmds}
|
||||
|
||||
single bracketed {} "\"{bracketed}" "\033A\"x" "\"{bracketed}\"x" ${vimCmds}
|
||||
|
||||
# Syntax folding enabled by autocmd breaks expansion.
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {se cindent}
|
||||
lappend vimCmds {set bs=2 et sts=4 sw=4}
|
||||
lappend vimCmds {autocmd InsertEnter <buffer> let w:fdm=&foldmethod \
|
||||
| setl foldmethod=manual}
|
||||
lappend vimCmds {autocmd InsertLeave <buffer> let &foldmethod = w:fdm}
|
||||
lappend vimCmds {set foldmethod=marker}
|
||||
lappend vimCmds {set foldmarker={,}}
|
||||
lappend vimCmds {set foldlevel=0}
|
||||
lappend vimCmds {set backspace=2}
|
||||
single folding {} "" "iabc {\rx" "abc {\n x\n}" ${vimCmds}
|
||||
|
||||
# expand_cr != 2}
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 1}]
|
||||
lappend vimCmds {se cindent}
|
||||
lappend vimCmds {set bs=2 et sts=4 sw=4 ft=javascript}
|
||||
lappend vimCmds {let b:delimitMate_jump_expansion = 1}
|
||||
single axpand_cr_no_2 {} "abc(def)" "\$i\rx" "abc(def\n x)" ${vimCmds}
|
||||
|
||||
# expand_cr == 2
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 2}]
|
||||
lappend vimCmds {se cindent}
|
||||
lappend vimCmds {set bs=2 et sts=4 sw=4 ft=javascript}
|
||||
lappend vimCmds {let b:delimitMate_jump_expansion = 1}
|
||||
single expand_cr_2 {} "abc(def)" "\$i\rx" "abc(def\n x\n )" ${vimCmds}
|
||||
|
||||
# Play nice with smartindent
|
||||
set vimCmds [list {let g:delimitMate_expand_cr = 2}]
|
||||
lappend vimCmds {let b:delimitMate_jump_expansion = 1}
|
||||
lappend vimCmds {set smartindent}
|
||||
single smartindent-1 {} "" "i{\rx" "{\n x\n}" ${vimCmds}
|
||||
|
||||
single quotes-1 {} "" "i\" x" {" x"} ${vimCmds}
|
||||
|
||||
single quotes-2 {} "" "i\"\rx" "\"\nx\"" ${vimCmds}
|
||||
|
||||
lappend vimCmds {let g:delimitMate_expand_inside_quotes = 1}
|
||||
single quotes-3 {} "" "i\"\nx" "\"\nx\n\"" ${vimCmds}
|
||||
|
||||
|
||||
|
||||
################################################################
|
||||
# This gives nice statistics and cleans up the mess left behind.
|
||||
cleanupTests
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
48
test/expand_space.test
Normal file
48
test/expand_space.test
Normal file
@@ -0,0 +1,48 @@
|
||||
# singleTest name desc setup input result vimCmds? skipScript?
|
||||
#
|
||||
# - desc can be empty and input would be used.
|
||||
# - vimCmds is a list of ex commands.
|
||||
# - skipScript will be evaluated in the scope of the function "single" and it
|
||||
# should return a keywowd such as toDo, badTest or other as listed in the
|
||||
# docs for tcltest. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
# Get some help:
|
||||
source helper.tcl
|
||||
|
||||
set vimCmds [list {let g:delimitMate_expand_space = 1}]
|
||||
lappend vimCmds {let g:delimitMate_autoclose = 1}
|
||||
|
||||
pairs pairs-1 {} "" "i( x" "( x )" ${vimCmds}
|
||||
|
||||
pairs pairs-2 {} "( )" "la\bx" "(x)" ${vimCmds}
|
||||
|
||||
pairs pairs-3 {} "" "iabc x" "abc x" ${vimCmds}
|
||||
|
||||
quotes quotes-1 {} "" "i' x" "' x'" ${vimCmds}
|
||||
|
||||
lappend vimCmds {let g:delimitMate_expand_inside_quotes = 1}
|
||||
quotes quotes-2 {} "" "i' x" "' x '" ${vimCmds}
|
||||
|
||||
quotes quotes-3 {} "" "i' \bx" "'x'" ${vimCmds}
|
||||
|
||||
set skipScript {string cat quoteBug}
|
||||
lappend vimCmds {let g:delimitMate_autoclose = 0}
|
||||
quotes quotes-4 {} "abc\\" "A'' x" "abc\\'' x '" ${vimCmds} ${skipScript}
|
||||
|
||||
# Issue #95
|
||||
lappend vimCmds {let b:delimitMate_jump_expansion = 1}
|
||||
set skipScript {string cat toDo}
|
||||
pairs issue_95 {} "" "i( test)x" "( test )x" ${vimCmds} ${skipScript}
|
||||
|
||||
pairs pairs-4 {} "" "i() \bx" "(x)" ${vimCmds}
|
||||
|
||||
quotes quotes-5 {} "" "i'' \bx" "'x'" ${vimCmds}
|
||||
|
||||
|
||||
|
||||
################################################################
|
||||
# This gives nice statistics and cleans up the mess left behind.
|
||||
cleanupTests
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
125
test/helper.tcl
Normal file
125
test/helper.tcl
Normal file
@@ -0,0 +1,125 @@
|
||||
if {[lsearch [namespace children] ::tcltest] == -1} {
|
||||
package require tcltest 2
|
||||
namespace import -force ::tcltest::*
|
||||
}
|
||||
|
||||
configure -verbose {body error skip}
|
||||
#configure -verbose {start msec pass body error skip}
|
||||
|
||||
set charMap [list \
|
||||
"\"" "\\\"" \
|
||||
"\$" "\\$" \
|
||||
"\[" "\\\[" \
|
||||
"\]" "\\\]" \
|
||||
"\\" "\\\\" \
|
||||
"{" "\\{" \
|
||||
"}" "\\}" \
|
||||
]
|
||||
|
||||
# In order to skip a test pass a script that, when evaluated, returns emptyTest
|
||||
# for tests that can not pass, or knownBug for ToDo features. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
proc single {name desc setup input result \
|
||||
{vimCmds {}} \
|
||||
{constr {}} \
|
||||
} {
|
||||
set fnamePrefix "test_${name}"
|
||||
global charMap
|
||||
makeFile ${setup} "${fnamePrefix}.in"
|
||||
makeFile {} "${fnamePrefix}.out"
|
||||
makeFile [join ${vimCmds} "\n"] "${fnamePrefix}.vim"
|
||||
set input [string map ${charMap} ${input}]
|
||||
#puts [lindex ${vimCmds} 0]
|
||||
set optCharMap [list {[} {\[} {]} {\]}]
|
||||
set vimArgs [lmap option ${vimCmds} \
|
||||
{string cat " -c \"[string map $charMap ${option}]\""}]
|
||||
set body [string cat "
|
||||
exec -- ./test.exp \"${fnamePrefix}\" \"${input}\"
|
||||
return \[viewFile \"${fnamePrefix}.out\"\]
|
||||
" ]
|
||||
#puts ${body}
|
||||
if {[string length ${desc}] eq 0} {
|
||||
set desc ${input}
|
||||
}
|
||||
if {[string length ${constr}] ne 0} {
|
||||
#puts ${constr}
|
||||
set constr [eval ${constr}]
|
||||
#puts ${constr}
|
||||
}
|
||||
set name "${name}: \"${setup}\", \"${desc}\" ->"
|
||||
#puts $desc
|
||||
#puts $name
|
||||
test ${name} \
|
||||
${desc} \
|
||||
-body ${body} \
|
||||
-constraints ${constr} \
|
||||
-result ${result}
|
||||
}
|
||||
|
||||
proc multi {items evalScript name desc setup input result \
|
||||
{vimCmds {}} \
|
||||
{constr {}} \
|
||||
} {
|
||||
global charMap
|
||||
set minor 0
|
||||
foreach item $items {
|
||||
incr minor
|
||||
eval ${evalScript}
|
||||
foreach var {desc setup input result} {
|
||||
set "the_${var}" [string map ${aCharMap} [expr "$${var}"]]
|
||||
}
|
||||
set the_name "${name}.${minor}"
|
||||
single \
|
||||
${the_name} \
|
||||
${the_desc} \
|
||||
${the_setup} \
|
||||
${the_input} \
|
||||
${the_result} \
|
||||
${vimCmds} \
|
||||
${constr} \
|
||||
}
|
||||
}
|
||||
|
||||
proc quotes {name desc setup input result \
|
||||
{vimCmds {}} \
|
||||
{constr {}} \
|
||||
} {
|
||||
set quotes [list {'} \" {`} {«} {|}]
|
||||
set mapScript {set aCharMap [list "'" ${item}]}
|
||||
multi \
|
||||
${quotes} \
|
||||
${mapScript} \
|
||||
${name} \
|
||||
${desc} \
|
||||
${setup} \
|
||||
${input} \
|
||||
${result} \
|
||||
${vimCmds} \
|
||||
${constr} \
|
||||
}
|
||||
|
||||
proc pairs {name desc setup input result \
|
||||
{vimCmds {}} \
|
||||
{constr {}} \
|
||||
} {
|
||||
set pairs [list () \{\} \[\] <> ¿? ¡! ,:]
|
||||
set mapScript {
|
||||
set left [string index ${item} 0]
|
||||
set right [string index ${item} 1]
|
||||
set aCharMap [list ( ${left} ) ${right}]
|
||||
}
|
||||
multi \
|
||||
${pairs} \
|
||||
${mapScript} \
|
||||
${name} \
|
||||
${desc} \
|
||||
${setup} \
|
||||
${input} \
|
||||
${result} \
|
||||
${vimCmds} \
|
||||
${constr} \
|
||||
}
|
||||
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
153
test/pairs.test
Normal file
153
test/pairs.test
Normal file
@@ -0,0 +1,153 @@
|
||||
# singleTest name desc setup input result vimCmds? skipScript?
|
||||
#
|
||||
# - desc can be empty and input would be used.
|
||||
# - vimCmds is a list of ex commands.
|
||||
# - skipScript will be evaluated in the scope of the function "single" and it
|
||||
# should return a keywowd such as toDo, badTest or other as listed in the
|
||||
# docs for tcltest. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
# Get some help:
|
||||
source helper.tcl
|
||||
|
||||
set vimCmds [list ]
|
||||
pairs autoclose-1 {} {} "i(" "()"
|
||||
|
||||
pairs autoclose-2 {} {()} "a\b" ""
|
||||
|
||||
pairs autoclose-3 {} "()" "a)x" "()x"
|
||||
|
||||
set skipScript {string cat {toDo}}
|
||||
single jump_all {} "" "((<magic>x" "(())x" {} ${skipScript}
|
||||
|
||||
pairs undo {} "" "i(x\033u" ""
|
||||
|
||||
pairs autoclose-4 {} "" "i@(x" "@(x)"
|
||||
|
||||
pairs autoclose-5 {} "@#" "a(x" "@(x)#"
|
||||
|
||||
pairs autoclose-6 {} "\\" "a(x" "\\(x"
|
||||
|
||||
pairs autoclose-7 {} "(\\)" "la)x" "(\\)x)"
|
||||
|
||||
pairs autoclose-8 {} {"abc"} "ifoo(" "foo(\"abc\""
|
||||
|
||||
set vimCmds [list {let g:delimitMate_autoclose = 0}]
|
||||
pairs noautoclose-1 {} "" "i(x" "(x" ${vimCmds}
|
||||
|
||||
pairs noautoclose-2 {} "" "i()x" "(x)" ${vimCmds}
|
||||
|
||||
pairs noautoclose-3 {} "" "i())x" "()x" ${vimCmds}
|
||||
|
||||
pairs noautoclose-4 {} "" "i()\bx" "x" ${vimCmds}
|
||||
|
||||
pairs noautoclose-5 {} "" "i@()x" "@(x)" ${vimCmds}
|
||||
|
||||
pairs noautoclose-6 {} "@#" "a()x" "@(x)#" ${vimCmds}
|
||||
|
||||
#" Handle backspace gracefully.
|
||||
set vimCmds [list {set backspace=}]
|
||||
pairs bad_bs {} "" "i(\033a\bx" "(x)" ${vimCmds}
|
||||
|
||||
set vimCmds [list ]
|
||||
|
||||
# closing parens removes characters. #133
|
||||
pairs autoclose-9 {} "(a)" "a)" "()a)" ${vimCmds}
|
||||
|
||||
# Expand iabbreviations
|
||||
set vimCmds [list {iabb def ghi}]
|
||||
# Not sure how to make it work on the test
|
||||
pairs iabbr {} "" "idef(" "ghi()" ${vimCmds}
|
||||
|
||||
set vimCmds [list ]
|
||||
|
||||
pairs autoclose-10 {} {abc а} {$i(} {abc (а} ${vimCmds}
|
||||
|
||||
pairs autoclose-11 {} "abc ñ" "\$i(" "abc (ñ" ${vimCmds}
|
||||
|
||||
pairs autoclose-12 {} "abc \$" "\$i(" "abc (\$" ${vimCmds}
|
||||
|
||||
pairs autoclose-13 {} "abc £" "\$i(" "abc (£" ${vimCmds}
|
||||
|
||||
pairs autoclose-14 {} "abc d" "\$i(" "abc (d" ${vimCmds}
|
||||
|
||||
pairs autoclose-15 {} "abc ." "\$i(" "abc ()." ${vimCmds}
|
||||
|
||||
pairs autoclose-16 {} "abc " "\$i(" "abc () " ${vimCmds}
|
||||
|
||||
pairs autoclose-17 {} "abc (" "\$i(" "abc ((" ${vimCmds}
|
||||
|
||||
# Play nice with undo.
|
||||
pairs undo {} "" "ia\007u(c)b\033u" "a" ${vimCmds}
|
||||
|
||||
# TODO: way to jump over one or several closing chars
|
||||
set skipScript {string cat {toDo}}
|
||||
single jump_to {} "()" "a\<magic>x" "()x" ${vimCmds} ${skipScript}
|
||||
|
||||
single jump_to {} "{()}" "la\\<magic>x" "{()}x" ${vimCmds} ${skipScript}
|
||||
|
||||
set vimCmds [list {let g:delimitMate_balance_pairs = 0}]
|
||||
pairs no_balance_pairs-1 {} "ab cd)" "la(x" "ab(x) cd)" ${vimCmds}
|
||||
|
||||
# Issue #229
|
||||
pairs issue_229-1 {} "((ab cd)" "\$i)x" "((ab cd)x" ${vimCmds}
|
||||
|
||||
set vimCmds [list ]
|
||||
|
||||
set vimCmds [list {let g:delimitMate_balance_pairs = 1}]
|
||||
pairs issue_229-2 {} "ab cd)" "la(x" "ab(x cd)" ${vimCmds}
|
||||
|
||||
# Issue #229
|
||||
pairs issue_229-3 {} "((ab cd)" "\$i)x" "((ab cd)x)" ${vimCmds}
|
||||
|
||||
# Issue #220
|
||||
set vimCmds [list {let g:delimitMate_jump_next = 0}]
|
||||
pairs issue_220-1 {} "()" "a)" "())" ${vimCmds}
|
||||
|
||||
# Issues #207 and #223
|
||||
set vimCmds [list {let g:delimitMate_jump_long = 1}]
|
||||
pairs jump_long-1 {} "{\[(foobar)\]}" "fbi)x" "{\[(foobar)x\]}" ${vimCmds}
|
||||
|
||||
# Issues #207 and #223
|
||||
set skipScript {expr "[string first {[[foobar]]} \"${setup}\"] > -1 \
|
||||
? {badTest} : {}"}
|
||||
single jump_long-2 {} "{\[(foobar)\]}" "fbi\]x" "{\[(foobar)\]x}" ${vimCmds} ${skipScript}
|
||||
|
||||
# Issues #207 and #223
|
||||
set skipScript {string cat {toDo}}
|
||||
set vimCmds [list {let g:delimitMate_jump_all = 1}]
|
||||
single issues_207_223 {} "{\[(foobar)\]}" "fbi<magic>x" "{\[(foobar)\]}x" \
|
||||
${vimCmds} ${skipScript}
|
||||
|
||||
set vimCmds [list {let g:delimitMate_jump_back = 1}]
|
||||
pairs jump_back {} "" "i()x" "()x" ${vimCmds}
|
||||
|
||||
# Disable on syntax groups
|
||||
set vimCmds [list {syntax on}]
|
||||
lappend vimCmds {set ft=vim}
|
||||
lappend vimCmds {let g:delimitMate_excluded_regions = ['String']}
|
||||
pairs ignore_syntax {} {echo " "} "f\"la(" {echo " ( "} ${vimCmds}
|
||||
|
||||
#" Issue #160
|
||||
set vimCmds [list {filetype indent plugin on}]
|
||||
lappend vimCmds {set ft=php}
|
||||
set skipScript {string cat {toDo}}
|
||||
single issue_160 {} "<?php incl" "A\x18\x0F\x19" "<?php include()" \
|
||||
${vimCmds} ${skipScript}
|
||||
|
||||
set vimCmds [list ]
|
||||
|
||||
# Play nice with redo
|
||||
pairs redo {} "abc " "Afoo(x\033." "abc foo(x)foo(x)" ${vimCmds}
|
||||
|
||||
pairs smart {} {""} "0a(x" {"(x"}
|
||||
|
||||
pairs smart {} {""} "0a()x" {"(x)"}
|
||||
|
||||
|
||||
|
||||
################################################################
|
||||
# This gives nice statistics and cleans up the mess left behind.
|
||||
cleanupTests
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
107
test/quotes.test
Normal file
107
test/quotes.test
Normal file
@@ -0,0 +1,107 @@
|
||||
# singleTest name desc setup input result vimCmds? skipScript?
|
||||
#
|
||||
# - desc can be empty and input would be used.
|
||||
# - vimCmds is a list of ex commands.
|
||||
# - skipScript will be evaluated in the scope of the function "single" and it
|
||||
# should return a keywowd such as toDo, badTest or other as listed in the
|
||||
# docs for tcltest. e.g.:
|
||||
# {expr "[string first {i'} \"${input}\"] > -1 ? {emptyTest} : {}"}
|
||||
# see tcltest documentation for other values.
|
||||
|
||||
# Get some help:
|
||||
source helper.tcl
|
||||
|
||||
quotes autoclose-1 {} {} "i'x" "'x'"
|
||||
|
||||
quotes autoclose-2 {} {} "i'x\033u" {}
|
||||
|
||||
quotes autoclose-3 {} {} {i''x} {''x}
|
||||
|
||||
quotes autoclose-4 {} {''} "a\bx" {x}
|
||||
|
||||
set skipScript {expr "[string first {i\"} \"${input}\"] > -1 ? {badTest} : {}"}
|
||||
quotes autoclose-5 {} "" "i'x\"" "'x\"'" {} ${skipScript}
|
||||
|
||||
quotes autoclose-6 {} {} "i@'x" "@'x'"
|
||||
|
||||
quotes autoclose-7 {} {@#} "a'x" "@'x'#"
|
||||
|
||||
#quotes autoclose-8 {} {} "'\<S-Tab>x" "''x"
|
||||
|
||||
single autoclose-8 {} {abc'} "A'" "abc'" {} {string cat toDo}
|
||||
|
||||
quotes autoclose-9 {} "abc\\" "A'x" {abc\'x}
|
||||
|
||||
quotes autoclose-10 {} {} "au'Привет'" "u'Привет'"
|
||||
|
||||
quotes autoclose-11 {} {} "au'string'" "u'string'"
|
||||
|
||||
set vimCmds [list {let g:delimitMate_autoclose = 0}]
|
||||
quotes noautoclose-1 {} {} "a'x" "'x" ${vimCmds}
|
||||
|
||||
quotes noautoclose-2 {} {} "a''x" "'x'" ${vimCmds}
|
||||
|
||||
quotes noautoclose-3 {} {} "a'''x" "''x" ${vimCmds}
|
||||
|
||||
quotes noautoclose-4 {} {} "a''\bx" "x" ${vimCmds}
|
||||
|
||||
quotes noautoclose-5 {} {} "a@''x" "@'x'" ${vimCmds}
|
||||
|
||||
quotes noautoclose-6 {} "@#" "a''x" "@'x'#" ${vimCmds}
|
||||
|
||||
set vimCmds [list {let g:delimitMate_autoclose = 1}]
|
||||
# Handle backspace gracefully.
|
||||
lappend vimCmds {set backspace=}
|
||||
quotes badBS-1 {} {} "a'\033a\bx" "'x'" ${vimCmds}
|
||||
|
||||
set vimCmds [list {set cpo=ces$}]
|
||||
quotes cpo {} {} "a'x" "'x'" ${vimCmds}
|
||||
|
||||
# Make sure smart quote works beyond first column.
|
||||
quotes beyond_first_column {} { } "a'x" " 'x'"
|
||||
|
||||
# smart quote, check fo char on the right.
|
||||
quotes smart_quote-1 {} "a b" "la'" "a 'b"
|
||||
|
||||
# Make sure we jump over a quote on the right. #89.
|
||||
quotes autoclose-12 {} {} "a('test'x" "('test'x)"
|
||||
|
||||
# Duplicate whole line when inserting quote at bol #105
|
||||
quotes autoclose-13 {} "}" "i'" "''}"
|
||||
|
||||
quotes autoclose-14 {} "'abc " "A'" "'abc '"
|
||||
|
||||
quotes autoclose-15 {} "''abc " "A'" "''abc ''"
|
||||
|
||||
# Nesting quotes:
|
||||
set vimCmds [list {let g:delimitMate_nesting_quotes = delimitMate#option('quotes')}]
|
||||
quotes nesting-1 {} "''" "A'x" "'''x'''" ${vimCmds}
|
||||
|
||||
quotes nesting-2 {} "'''" "A'x" "''''x''''" ${vimCmds}
|
||||
|
||||
quotes nesting-3 {} {} "i''x" "''x" ${vimCmds}
|
||||
|
||||
quotes nesting-4 {} {} "i'x" "'x'" ${vimCmds}
|
||||
|
||||
set vimCmds [list]
|
||||
|
||||
# expand iabbreviations
|
||||
set vimCmds [list {iabb def ghi}]
|
||||
single iabbr {} {} {idef"} {ghi"} ${vimCmds}
|
||||
|
||||
set vimCmds [list]
|
||||
|
||||
quotes autoclose-16 {} {} "i'\n\b" "''"
|
||||
|
||||
# Double quote starts a comment in viml
|
||||
set vimCmds [list {set ft=vim}]
|
||||
single vim_comment {} {} {i"} {"} ${vimCmds}
|
||||
|
||||
#" Allow quote to exit from string when disabled by syntax group.
|
||||
set vimCmds [list {syntax on}]
|
||||
quotes disabled_syntax {} "'abc'" "\$i'x" "'abc'x" ${vimCmds}
|
||||
|
||||
# --------
|
||||
# This gives nice statistics and cleans up the mess left behind.
|
||||
cleanupTests
|
||||
# vim: set filetype=tcl et sw=2 sts=0 ts=8:
|
||||
20
test/test.exp
Executable file
20
test/test.exp
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env expect -f
|
||||
|
||||
set testName [lindex $argv 0]
|
||||
set filein "${testName}.in"
|
||||
set fileout "${testName}.out"
|
||||
set input [lindex $argv 1]
|
||||
|
||||
set timeout 2
|
||||
spawn env TERM=dumb vim -N -i NONE -u _setup.vim -S "${testName}.vim" -- ${filein}
|
||||
match_max 100000
|
||||
expect -exact "Start test"
|
||||
foreach char [split ${input} {}] {
|
||||
send -- "${char}"
|
||||
sleep .01
|
||||
}
|
||||
send -- " "
|
||||
sleep .01
|
||||
send -- ":w! ${fileout}\r"
|
||||
send -- ":qa!\r"
|
||||
expect eof
|
||||
Reference in New Issue
Block a user