Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

225 lines (207 sloc) 2.531 kb
Test for *sub-replace-special* and *sub-replace-expression* on :substitute.
Test for submatch() on :substitue.
Test for *:s%* on :substitute.
STARTTEST
:so small.vim
ENDTEST
Results of test71:
STARTTEST
:set magic
:set cpo&
/^TEST/
j:s/A/&&/
j:s/B/\&/
j:s/C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/
j:s/D/d/
j:s/E/~/
j:s/F/\~/
j:s/G/\ugg/
j:s/H/\Uh\Eh/
j:s/I/\lII/
j:s/J/\LJ\EJ/
j:s/K/\Uk\ek/
j:s/L/ /
j:s/M/\r/
j:s/N/\ /
j:s/O/\n/
j:s/P/\b/
j:s/Q/\t/
j:s/R/\\/
j:s/S/\c/
j:s/T//
ENDTEST
TEST_1:
A
B
C123456789
D
E
F
G
H
I
J
K
lLl
mMm
nNn
oOo
pPp
qQq
rRr
sSs
tTt
STARTTEST
:set nomagic
:set cpo&
/^TEST/
j:s/A/&&/
j:s/B/\&/
j:s/\mC\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/
j:s/D/d/
j:s/E/~/
j:s/F/\~/
j:s/G/\ugg/
j:s/H/\Uh\Eh/
j:s/I/\lII/
j:s/J/\LJ\EJ/
j:s/K/\Uk\ek/
j:s/L/ /
j:s/M/\r/
j:s/N/\ /
j:s/O/\n/
j:s/P/\b/
j:s/Q/\t/
j:s/R/\\/
j:s/S/\c/
j:s/T//
ENDTEST
TEST_2:
A
B
C123456789
D
E
F
G
H
I
J
K
lLl
mMm
nNn
oOo
pPp
qQq
rRr
sSs
tTt
STARTTEST
:set magic&
:set cpo&
/^TEST/
j:s/A/\='\'/
j:s/B/\='\\'/
j:s/C/\=' '/
j:s/D/\='\ '/
j:s/E/\='\\ '/
j:s/F/\='\r'/
j:s/G/\=''/
j:s/H/\='\'/
j:s/I/\='\\'/
j:s/J/\='\n'/
j:s/K/\="\r"/
j:s/L/\="\n"/
ENDTEST
TEST_3:
aAa
bBb
cCc
dDd
eEe
fFf
gGg
hHh
iIi
jJj
kKk
lLl
STARTTEST
:set magic&
:set cpo&
/^TEST/
j:s/A/\=substitute(submatch(0), '.', '\', '')/
j:s/B/\=substitute(submatch(0), '.', '\\', '')/
j:s/C/\=substitute(submatch(0), '.', ' ', '')/
j:s/D/\=substitute(submatch(0), '.', '\ ', '')/
j:s/E/\=substitute(submatch(0), '.', '\\ ', '')/
j:s/F/\=substitute(submatch(0), '.', '\r', '')/
j:s/G/\=substitute(submatch(0), '.', '', '')/
j:s/H/\=substitute(submatch(0), '.', '\', '')/
j:s/I/\=substitute(submatch(0), '.', '\\', '')/
j:s/J/\=substitute(submatch(0), '.', '\n', '')/
j:s/K/\=substitute(submatch(0), '.', "\r", '')/
j:s/L/\=substitute(submatch(0), '.', "\n", '')/
ENDTEST
TEST_4:
aAa
bBb
cCc
dDd
eEe
fFf
gGg
hHh
iIi
jJj
kKk
lLl
STARTTEST
:set magic&
:set cpo&
/^TEST/
j:s/A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)/
ENDTEST
TEST_5:
A123456789
STARTTEST
:set magic&
/^TEST/
:set cpo+=/
j:s/A/a/
j:s/B/%/
:set cpo-=/
j:s/C/c/
j:s/D/%/
ENDTEST
TEST_6:
A
B
C
D
STARTTEST
:set magic&
:set cpo&
/^TEST/
j:s/A./\=submatch(0)/
j:s/B./\=submatch(0)/
ENDTEST
TEST_7:
A A
BB
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
ENDTEST
Jump to Line
Something went wrong with that request. Please try again.