mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-08 09:53:51 -05:00
216 lines
3.2 KiB
Plaintext
216 lines
3.2 KiB
Plaintext
Include: include/setup.vader
|
|
|
|
Given (Table):
|
|
|a|b|c|d|
|
|
| -|-|>-|-|
|
|
|aaa|bbb|ccc|ddd|
|
|
|
|
Do (Partial alignment around 1st |):
|
|
\<C-V>ljj\<Enter>|
|
|
|
|
Expect (Right margin should be correctly attached):
|
|
| a|b|c|d|
|
|
| -|-|>-|-|
|
|
| aaa|bbb|ccc|ddd|
|
|
|
|
Given (empty buffer):
|
|
|
|
Execute (Aligning lines with many delimiters should not fail):
|
|
call visualmode(1)
|
|
call setline(1, repeat('|', &maxfuncdepth + 1))
|
|
%EasyAlign*|
|
|
AssertEqual (&maxfuncdepth + 1) * 3 - 2, len(getline(1))
|
|
|
|
Given:
|
|
a | b | c
|
|
aa | bb | cc
|
|
|
|
Execute:
|
|
%EasyAlign*|iu0{'l':'<', 'r': '>'}
|
|
|
|
Expect:
|
|
a <|>b <|>c
|
|
aa<|>bb<|>cc
|
|
|
|
Given (Trailing delimiter):
|
|
a | b | c |
|
|
aa | bb | cc |
|
|
|
|
Execute:
|
|
%EasyAlign*|iu0{'l':'<', 'r': '>'}
|
|
|
|
Expect:
|
|
a <|>b <|>c <|
|
|
aa<|>bb<|>cc<|
|
|
|
|
Given (Tab-indented code (#20)):
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=1
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=2
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=4
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=8
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=12
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
n2f = {}
|
|
n2v = {}
|
|
f2v = {}
|
|
n2gv = {}
|
|
n2vt = {}
|
|
|
|
Given (Tab-indented code (#20)):
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
# n2f= {}
|
|
## n2v= {}
|
|
# f2v = {}
|
|
## n2gv = {}
|
|
# n2vt = {}
|
|
|
|
Execute:
|
|
set tabstop=12
|
|
%EasyAlign=
|
|
|
|
Expect:
|
|
class MyUnitTest(unittest.TestCase):
|
|
def test_base(self):
|
|
# n2f = {}
|
|
## n2v = {}
|
|
# f2v = {}
|
|
## n2gv = {}
|
|
# n2vt = {}
|
|
|
|
Given (Some text):
|
|
a,b,c
|
|
|
|
d,e,f
|
|
|
|
Do (Select 1st line, align 3rd line):
|
|
- First line
|
|
V\<esc>
|
|
- Last line
|
|
G
|
|
- Align
|
|
\<space>Aip*,
|
|
- Previous selection
|
|
gv
|
|
- Upcase
|
|
U
|
|
|
|
Expect:
|
|
A,B,C
|
|
|
|
d, e, f
|
|
|
|
Given c (#40 Ignored delimiters in LiveEasyAlign causes spurious undo):
|
|
printf("foo = %f\n", foo);
|
|
printf("foobar = %f\n", foobar);
|
|
|
|
Do:
|
|
gUiw
|
|
:%LiveEasyAlign\<enter>
|
|
=\<bs>==
|
|
|
|
Expect c:
|
|
PRINTF("foo = %f\n", foo);
|
|
printf("foobar = %f\n", foobar);
|
|
|
|
* #50 Error when using delimiter alignment option
|
|
Given:
|
|
a|bbb|c
|
|
aa|bb|cc
|
|
|
|
Do (#50 EasyAlign command with 'a' option):
|
|
:%EasyAlign {'a': 'l'}\<cr>
|
|
\<cr>
|
|
*|
|
|
|
|
Expect (Some text):
|
|
a | bbb | c
|
|
aa | bb | cc
|
|
|
|
* #51 Repeat of visual <Plug>(LiveEasyAlign) broken
|
|
Do (#51/#52 <Plug>(EasyAlignRepeat) in visual mode):
|
|
V\<space>\<enter>\<enter>*||
|
|
G
|
|
V\<space>.
|
|
|
|
Expect:
|
|
a | bbb | c
|
|
aa | bb | cc
|
|
|
|
* #65 ?=
|
|
Given:
|
|
a?=b
|
|
aa-=bb
|
|
aaa?=bbb
|
|
|
|
Do (#65 Alignment around ?=):
|
|
\<space>Aip=
|
|
|
|
Expect:
|
|
a ?= b
|
|
aa -= bb
|
|
aaa ?= bbb
|
|
|
|
Include: include/teardown.vader
|