mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-11 03:13:48 -05:00
1769 lines
42 KiB
Plaintext
1769 lines
42 KiB
Plaintext
Include: include/setup.vader
|
|
|
|
###########################################################
|
|
|
|
Given (space-separated columns):
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2 33 444 555 66 777 8
|
|
|
|
Do (left-align):
|
|
vip
|
|
\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2 33 444 555 66 777 8
|
|
|
|
Do (left-align / cursor position retained):
|
|
vGww
|
|
\<Enter>
|
|
*\<Space>D
|
|
|
|
Expect:
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2
|
|
|
|
Do (left-align using operator map):
|
|
\<Space>Aip*\<Space>
|
|
|
|
Expect:
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2 33 444 555 66 777 8
|
|
|
|
Do (right-align):
|
|
vip
|
|
\<Enter>\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2 33 444 555 66 777 8
|
|
|
|
Do (center-align):
|
|
vip
|
|
\<Enter>\<Enter>\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
1 22222 33 444 555 6666 7 888
|
|
11 222 3333 4 55 6666 77 888
|
|
111 22 333 444 55555 6666 7 88888
|
|
1111 2 33 444 555 66 777 8
|
|
|
|
Given (comma-separated columns):
|
|
a,,bbb
|
|
aa,,bb
|
|
aaa,,b
|
|
aaaa,,
|
|
aaa,b,
|
|
aa,bb,
|
|
a,bbb,
|
|
|
|
Do (left-align):
|
|
vip
|
|
\<Enter>
|
|
*,
|
|
|
|
Expect:
|
|
a, , bbb
|
|
aa, , bb
|
|
aaa, , b
|
|
aaaa, ,
|
|
aaa, b,
|
|
aa, bb,
|
|
a, bbb,
|
|
|
|
Do (right-align):
|
|
vip
|
|
\<Enter>\<Enter>
|
|
*,
|
|
|
|
Expect:
|
|
a, , bbb
|
|
aa, , bb
|
|
aaa, , b
|
|
aaaa, ,
|
|
aaa, b,
|
|
aa, bb,
|
|
a, bbb,
|
|
|
|
Do (center-align):
|
|
vip
|
|
\<Enter>\<Enter>\<Enter>
|
|
*,
|
|
|
|
Expect:
|
|
a, , bbb
|
|
aa, , bb
|
|
aaa, , b
|
|
aaaa, ,
|
|
aaa, b,
|
|
aa, bb,
|
|
a, bbb,
|
|
|
|
###########################################################
|
|
|
|
Given (the beatles):
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (around first space):
|
|
vip
|
|
\<Enter>
|
|
\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (around second space):
|
|
vip
|
|
\<Enter>
|
|
2\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (around all spaces):
|
|
vip
|
|
\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (right-align around all spaces):
|
|
vip
|
|
\<Enter>\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (center-align around all spaces):
|
|
vip
|
|
\<Enter>\<Enter>\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (center-align around the last space):
|
|
vip
|
|
\<Enter>\<Enter>\<Enter>
|
|
-\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (right-align around second space):
|
|
vip
|
|
\<Enter>\<Enter>
|
|
2\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (left-right alternating alignment):
|
|
vip
|
|
\<Enter>
|
|
**\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (right-left alternating alignment):
|
|
vip
|
|
\<Enter>\<Enter>
|
|
**\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (with numeric left/right margin):
|
|
vip
|
|
\<Enter>
|
|
*
|
|
\<C-L>2\<Enter>
|
|
\<Enter>
|
|
\<C-R>5\<Enter>
|
|
*
|
|
\<Space>
|
|
|
|
Expect:
|
|
Paul McCartney 1942
|
|
George Harrison 1943mmdd
|
|
Ringo Starr 1940mm
|
|
Pete Best 1941
|
|
|
|
Do (with string left/right margin):
|
|
vip
|
|
\<Enter>
|
|
\<C-L>lft\<Enter>
|
|
\<C-R>rgt\<Enter>
|
|
*\<Space>
|
|
|
|
Expect:
|
|
Paul lft rgtMcCartneylft rgt1942
|
|
Georgelft rgtHarrison lft rgt1943mmdd
|
|
Ringo lft rgtStarr lft rgt1940mm
|
|
Pete lft rgtBest lft rgt1941
|
|
|
|
Execute (with regular expression):
|
|
1,4EasyAlign*/../
|
|
|
|
Expect:
|
|
Pa ul Mc Ca rt ne y 19 42
|
|
Ge or ge Ha rr is on 19 43 mm dd
|
|
Ri ng o St ar r 19 40 mm
|
|
Pe te Be st 19 41
|
|
|
|
###########################################################
|
|
|
|
Given ruby (delimiters in comments and strings):
|
|
xyz="abc=def"
|
|
a=b#=c
|
|
|
|
Do (align around all =):
|
|
vip
|
|
\<Enter>*=
|
|
|
|
Expect ruby (are not aligned):
|
|
xyz = "abc=def"
|
|
a = b#=c
|
|
|
|
###########################################################
|
|
|
|
Given javascript (json):
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver: "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
|
|
url: 'jdbc:mysql://localhost/test',
|
|
database: "test",
|
|
"user:pass":"r00t:pa55"
|
|
};
|
|
|
|
Do (around colons):
|
|
vip\<Enter>*:
|
|
|
|
Expect javascript:
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver: "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
|
|
url: 'jdbc:mysql://localhost/test',
|
|
database: "test",
|
|
"user:pass": "r00t:pa55"
|
|
};
|
|
|
|
Do (around colons, do not stick to left):
|
|
vip\<Enter>*\<Right>:
|
|
|
|
Expect javascript:
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver : "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
|
|
url : 'jdbc:mysql://localhost/test',
|
|
database : "test",
|
|
"user:pass" : "r00t:pa55"
|
|
};
|
|
|
|
Do (around first colon, do not ignore comments and strings):
|
|
vip\<Enter>\<C-G>*:
|
|
|
|
Expect javascript:
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver: "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc: mysql: //HOSTNAME/DATABASE) */
|
|
url: 'jdbc: mysql: //localhost/test',
|
|
database: "test",
|
|
"user: pass": "r00t: pa55"
|
|
};
|
|
|
|
Do (do not ignore comments and strings, do not ignore unmatched):
|
|
vip\<Enter>\<C-G>\<C-U>*:
|
|
|
|
Expect javascript:
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver: "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc: mysql: //HOSTNAME/DATABASE) */
|
|
url: 'jdbc: mysql: //localhost/test',
|
|
database: "test",
|
|
"user: pass": "r00t: pa55"
|
|
};
|
|
|
|
Execute (set g:easy_align_ignore_groups and g:easy_align_ignore_unmatched):
|
|
let g:easy_align_ignore_unmatched = 0
|
|
let g:easy_align_ignore_groups = []
|
|
|
|
Do (do not ignore comments and strings, do not ignore unmatched using global vars):
|
|
vip\<Enter>*:
|
|
|
|
Expect javascript:
|
|
var jdbc = {
|
|
// JDBC driver for MySQL database:
|
|
driver: "com.mysql.jdbc.Driver",
|
|
/* JDBC URL for the connection (jdbc: mysql: //HOSTNAME/DATABASE) */
|
|
url: 'jdbc: mysql: //localhost/test',
|
|
database: "test",
|
|
"user: pass": "r00t: pa55"
|
|
};
|
|
|
|
Execute (unset g:easy_align_ignore_groups and g:easy_align_ignore_unmatched):
|
|
unlet g:easy_align_ignore_unmatched
|
|
unlet g:easy_align_ignore_groups
|
|
|
|
###########################################################
|
|
|
|
Given (table):
|
|
| Option| Type | Default | Description |
|
|
|--|--|--|--|
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
|queues |Fixnum | 1 | number of concurrent queues |
|
|
|queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
|batch | Boolean | false | enables batch processing mode |
|
|
|batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
|logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (around all |):
|
|
vip\<Enter>*|
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (around all |, and right-align 3rd and center-align the last):
|
|
vip\<Enter>*|
|
|
gv\<Enter>\<Enter>3|
|
|
gv\<Enter>\<Enter>\<Enter>-|
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (Left-right alternating alignment):
|
|
vip\<Enter>**|
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (Right-left alternating alignment):
|
|
vip\<Enter>\<Enter>**|
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (Right-left alternating alignment, indent: deep):
|
|
vip\<Enter>\<Enter>**\<C-I>\<C-I>|
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
# Doesn't work. Why?
|
|
# Do (Repeat the last command):
|
|
# :%\<C-R>=g:easy_align_last_command\<Enter>\<Enter>
|
|
|
|
Execute (Repeat the last command):
|
|
Log g:easy_align_last_command
|
|
execute '%'.g:easy_align_last_command
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
| threads | Fixnum | 1 | number of threads in the thread pool |
|
|
| queues | Fixnum | 1 | number of concurrent queues |
|
|
| queue_size | Fixnum | 1000 | size of each queue |
|
|
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
|
| batch | Boolean | false | enables batch processing mode |
|
|
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
|
| logger | Logger | nil | logger instance for debug logs |
|
|
|
|
Do (around all | with no margin, right-align 2nd to last):
|
|
vip\<Enter>\<C-L>0\<Enter>\<C-R>0\<Enter>*|
|
|
vip\<Enter>\<Enter>\<C-L>0\<Enter>\<C-R>0\<Enter>-2|
|
|
|
|
Expect:
|
|
|Option |Type |Default|Description |
|
|
|-- |-- | --|-- |
|
|
|threads |Fixnum | 1|number of threads in the thread pool |
|
|
|queues |Fixnum | 1|number of concurrent queues |
|
|
|queue_size|Fixnum | 1000|size of each queue |
|
|
|interval |Numeric| 0|dispatcher interval for batch processing |
|
|
|batch |Boolean| false|enables batch processing mode |
|
|
|batch_size|Fixnum | nil|number of maximum items to be assigned at once|
|
|
|logger |Logger | nil|logger instance for debug logs |
|
|
|
|
Do (live interactive mode):
|
|
vip\<Space>\<Enter>
|
|
|
|
|
\<C-L>(\<Enter>
|
|
\<C-R>)\<Enter>
|
|
***
|
|
**
|
|
\<BS>\<BS>\<BS>
|
|
**|\<Enter>|
|
|
|
|
Expect:
|
|
|)Option (|) Type(|)Default(|) Description(|
|
|
|)-- (|) --(|)-- (|) --(|
|
|
|)threads (|) Fixnum(|)1 (|) number of threads in the thread pool(|
|
|
|)queues (|) Fixnum(|)1 (|) number of concurrent queues(|
|
|
|)queue_size(|) Fixnum(|)1000 (|) size of each queue(|
|
|
|)interval (|)Numeric(|)0 (|) dispatcher interval for batch processing(|
|
|
|)batch (|)Boolean(|)false (|) enables batch processing mode(|
|
|
|)batch_size(|) Fixnum(|)nil (|)number of maximum items to be assigned at once(|
|
|
|)logger (|) Logger(|)nil (|) logger instance for debug logs(|
|
|
|
|
Do (Switching to live interactive mode):
|
|
vip\<Enter>
|
|
* Switch to live interactive mode
|
|
\<C-P>
|
|
|
|
|
\<C-L><\<Enter>
|
|
\<C-R>>\<Enter>
|
|
***
|
|
**
|
|
\<BS>\<BS>\<BS>
|
|
**|\<Enter>|
|
|
|
|
Expect:
|
|
|>Option <|> Type<|>Default<|> Description<|
|
|
|>-- <|> --<|>-- <|> --<|
|
|
|>threads <|> Fixnum<|>1 <|> number of threads in the thread pool<|
|
|
|>queues <|> Fixnum<|>1 <|> number of concurrent queues<|
|
|
|>queue_size<|> Fixnum<|>1000 <|> size of each queue<|
|
|
|>interval <|>Numeric<|>0 <|> dispatcher interval for batch processing<|
|
|
|>batch <|>Boolean<|>false <|> enables batch processing mode<|
|
|
|>batch_size<|> Fixnum<|>nil <|>number of maximum items to be assigned at once<|
|
|
|>logger <|> Logger<|>nil <|> logger instance for debug logs<|
|
|
|
|
Do (Toggling live interactive mode (delimiter entered)):
|
|
vip\<Enter>
|
|
* Enable live mode
|
|
\<C-P>
|
|
|*
|
|
* Disable live mode
|
|
\<C-P>
|
|
gg2jdG
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
|
|
Do (Toggling live interactive mode (delimiter not entered)):
|
|
vip\<Enter>
|
|
* Enable live mode
|
|
\<C-P>
|
|
\<Enter>
|
|
* Disable live mode
|
|
\<C-P>
|
|
*|
|
|
gg2jdG
|
|
|
|
Expect:
|
|
| Option | Type | Default | Description |
|
|
| -- | -- | -- | -- |
|
|
|
|
Do (live interactive mode!):
|
|
vip\<Space>r\<Enter>
|
|
|
|
|
\<C-L>[\<Enter>
|
|
\<C-R>]\<Enter>
|
|
***
|
|
**
|
|
\<BS>\<BS>\<BS>
|
|
**
|
|
\<C-I>\<C-I>
|
|
\<C-X>|\<Enter>
|
|
\<Enter>
|
|
\<C-X>
|
|
|
|
Expect:
|
|
[|] Option[|]Type [|]Default[|]Description [|
|
|
[|] --[|]-- [|] --[|]-- [|
|
|
[|] threads[|]Fixnum [|] 1[|]number of threads in the thread pool [|
|
|
[|] queues[|]Fixnum [|] 1[|]number of concurrent queues [|
|
|
[|]queue_size[|]Fixnum [|] 1000[|]size of each queue [|
|
|
[|] interval[|]Numeric[|] 0[|]dispatcher interval for batch processing [|
|
|
[|] batch[|]Boolean[|] false[|]enables batch processing mode [|
|
|
[|]batch_size[|]Fixnum [|] nil[|]number of maximum items to be assigned at once[|
|
|
[|] logger[|]Logger [|] nil[|]logger instance for debug logs [|
|
|
|
|
Execute (g:easy_align_last_command should be set):
|
|
Assert exists('g:easy_align_last_command')
|
|
unlet g:easy_align_last_command
|
|
|
|
Do:
|
|
vip\<Space>\<Enter>**|\<C-C>
|
|
|
|
Execute (g:easy_align_last_command should not be set if interrupted):
|
|
Assert !exists('g:easy_align_last_command')
|
|
|
|
###########################################################
|
|
|
|
Given (comma-separated items):
|
|
aaa, bb,c
|
|
d,eeeeeee
|
|
fffff, gggggggggg,
|
|
h, , ii
|
|
j,,k
|
|
|
|
Do (around all commas):
|
|
vip\<Enter>*,
|
|
|
|
Expect:
|
|
aaa, bb, c
|
|
d, eeeeeee
|
|
fffff, gggggggggg,
|
|
h, , ii
|
|
j, , k
|
|
|
|
Do (around all commas, do not stick to left):
|
|
vip\<Enter>\<Right>*,
|
|
|
|
Expect:
|
|
aaa , bb , c
|
|
d , eeeeeee
|
|
fffff , gggggggggg ,
|
|
h , , ii
|
|
j , , k
|
|
|
|
Do (center-align around all commas):
|
|
vip\<Enter>\<Enter>\<Enter>*,
|
|
|
|
Expect:
|
|
aaa, bb, c
|
|
d, eeeeeee
|
|
fffff, gggggggggg,
|
|
h, , ii
|
|
j, , k
|
|
|
|
###########################################################
|
|
|
|
Given ruby (multi-line ruby Hash):
|
|
options = { :caching => nil,
|
|
:versions => 3,
|
|
"cache=blocks" => false }.merge(options)
|
|
|
|
Do (around the last =):
|
|
vip\<Enter>-=
|
|
|
|
Expect ruby:
|
|
options = { :caching => nil,
|
|
:versions => 3,
|
|
"cache=blocks" => false }.merge(options)
|
|
|
|
Do (partial alignment):
|
|
f:
|
|
\<C-V>jj3E
|
|
\<Enter>\<Enter>=
|
|
|
|
Expect ruby:
|
|
options = { :caching => nil,
|
|
:versions => 3,
|
|
"cache=blocks" => false }.merge(options)
|
|
|
|
###########################################################
|
|
|
|
Given c (C code with comments 1):
|
|
/* a */ b = c
|
|
aa >= bb
|
|
// aaa = bbb = cccc
|
|
/* aaaa = */ bbbb === cccc " = dddd = " = eeee
|
|
aaaaa /* bbbbb */ == ccccc /* != eeeee = */ === fffff
|
|
|
|
Do:
|
|
vip\<Enter>*=
|
|
|
|
Expect c:
|
|
/* a */ b = c
|
|
aa >= bb
|
|
// aaa = bbb = cccc
|
|
/* aaaa = */ bbbb === cccc " = dddd = " = eeee
|
|
aaaaa /* bbbbb */ == ccccc /* != eeeee = */ === fffff
|
|
|
|
Do:
|
|
vip\<Enter>\<C-G>\<C-U>*=
|
|
|
|
Expect c:
|
|
/* a */ b = c
|
|
aa >= bb
|
|
// aaa = bbb = cccc
|
|
/* aaaa = */ bbbb === cccc " = dddd = " = eeee
|
|
aaaaa /* bbbbb */ == ccccc /* != eeeee = */ === fffff
|
|
|
|
###########################################################
|
|
|
|
Given c (C code with comments 2):
|
|
int a = 1;
|
|
long b = 2;
|
|
float c = 3;
|
|
string d = 4;
|
|
// this line should not get aligned
|
|
long int e = 5;
|
|
std::map f;
|
|
std::map g; /* this? */
|
|
short h /* how about this? */ = 6;
|
|
string i = "asdf";
|
|
|
|
Do (around =):
|
|
vip\<Enter>=
|
|
|
|
Expect c:
|
|
int a = 1;
|
|
long b = 2;
|
|
float c = 3;
|
|
string d = 4;
|
|
// this line should not get aligned
|
|
long int e = 5;
|
|
std::map f;
|
|
std::map g; /* this? */
|
|
short h /* how about this? */ = 6;
|
|
string i = "asdf";
|
|
|
|
Do (right-align around =, comment lines are ignored):
|
|
vip\<Enter>\<Enter>=
|
|
|
|
Expect c:
|
|
int a = 1;
|
|
long b = 2;
|
|
float c = 3;
|
|
string d = 4;
|
|
// this line should not get aligned
|
|
long int e = 5;
|
|
std::map f;
|
|
std::map g; /* this? */
|
|
short h /* how about this? */ = 6;
|
|
string i = "asdf";
|
|
|
|
Do (right-align around =, do not ignore comment lines):
|
|
vip\<Enter>\<Enter>\<C-U>=
|
|
|
|
Expect c:
|
|
int a = 1;
|
|
long b = 2;
|
|
float c = 3;
|
|
string d = 4;
|
|
// this line should not get aligned
|
|
long int e = 5;
|
|
std::map f;
|
|
std::map g; /* this? */
|
|
short h /* how about this? */ = 6;
|
|
string i = "asdf";
|
|
|
|
###########################################################
|
|
|
|
Given ruby (= operators):
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee=f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (1st =):
|
|
vip\<Enter>=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee=f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (LR =):
|
|
vip\<Enter>**=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee = f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (DEPRECATED: Alignment using mode_sequence, delimiter_align):
|
|
vip\<Enter>\<C-O>\<Backspace>cr*\<Enter>\<C-D>=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee = f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (Alignment using align, delimiter_align):
|
|
vip\<Enter>\<C-A>\<Backspace>cr*\<Enter>\<C-D>=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee = f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
|
|
Do (DEPRECATED: mode_sequence starting from 2nd, delimiter_align = center):
|
|
vip\<Enter>\<C-O>\<Backspace>rc**\<Enter>\<C-D>\<C-D>2=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee = f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (align starting from 2nd, delimiter_align = center):
|
|
vip\<Enter>\<C-A>\<Backspace>rc**\<Enter>\<C-D>\<C-D>2=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee = f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
Do (around all =s, do not ignore unmatched):
|
|
vip\<Enter>\<C-U>
|
|
\<C-L>0\<Enter>
|
|
\<C-R>0\<Enter>
|
|
\<C-D>\<C-D>
|
|
*=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee ===eee = eee = eee=f
|
|
fff = ggg +=gg &&=gg
|
|
g != hhhhhhhh==# 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<=123
|
|
aa >>=123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&=123
|
|
dddddd ||=123
|
|
dddddd /= 123
|
|
gg <=>ee
|
|
|
|
Do (Center-align around 2nd =):
|
|
vip\<Enter>\<Enter>\<Enter>2=
|
|
|
|
Expect ruby:
|
|
a =
|
|
a = 1
|
|
bbbb .= 2
|
|
ccccccc = 3
|
|
ccccccccccccccc
|
|
ddd = #
|
|
eeee === eee = eee = eee=f
|
|
fff = ggg += gg &&= gg
|
|
g != hhhhhhhh == # 8
|
|
i := 5
|
|
i %= 5
|
|
i *= 5
|
|
j =~ 5
|
|
j >= 5
|
|
aa => 123
|
|
aa <<= 123
|
|
aa >>= 123
|
|
bbb => 123
|
|
c => 1233123
|
|
d => 123
|
|
dddddd &&= 123
|
|
dddddd ||= 123
|
|
dddddd /= 123
|
|
gg <=> ee
|
|
|
|
###########################################################
|
|
|
|
Given ruby (Trailing ruby line comment):
|
|
apple = 1 # comment not aligned
|
|
apricot = 'DAD' + 'F#AD'
|
|
banana = 'Gros Michel' ## comment 2
|
|
|
|
Do (around the last spaces):
|
|
vip\<Enter>-\<Space>
|
|
|
|
Expect ruby:
|
|
apple = 1 # comment not aligned
|
|
apricot = 'DAD' + 'F#AD'
|
|
banana = 'Gros Michel' ## comment 2
|
|
|
|
Do (using # rule):
|
|
vip\<Enter>\<C-U>#
|
|
|
|
Expect ruby:
|
|
apple = 1 # comment not aligned
|
|
apricot = 'DAD' + 'F#AD'
|
|
banana = 'Gros Michel' ## comment 2
|
|
|
|
Do (using regular expression):
|
|
vip\<Enter>=
|
|
gv\<Enter>
|
|
\<C-U>\<C-G>\<C-G>
|
|
\<C-D>
|
|
\<C-X>#\+\<Enter>
|
|
|
|
Expect ruby:
|
|
apple = 1 # comment not aligned
|
|
apricot = 'DAD' + 'F#AD'
|
|
banana = 'Gros Michel' ## comment 2
|
|
|
|
###########################################################
|
|
|
|
Given (method chain):
|
|
my_object
|
|
.method1.chain
|
|
.second_method.call
|
|
.third.call
|
|
.method_4.execute
|
|
|
|
Do (around all .):
|
|
vip\<Enter>*.
|
|
|
|
Expect:
|
|
my_object
|
|
.method1 .chain
|
|
.second_method.call
|
|
.third .call
|
|
.method_4 .execute
|
|
|
|
Do (around all . with deep indentation):
|
|
vip\<Enter>\<C-I>\<C-I>*.
|
|
|
|
Expect:
|
|
my_object
|
|
.method1 .chain
|
|
.second_method.call
|
|
.third .call
|
|
.method_4 .execute
|
|
|
|
Execute (set g:easy_align_indentation):
|
|
let g:easy_align_indentation = 'd'
|
|
|
|
Do (around all . with deep indentation):
|
|
vip\<Enter>*.
|
|
|
|
Expect:
|
|
my_object
|
|
.method1 .chain
|
|
.second_method.call
|
|
.third .call
|
|
.method_4 .execute
|
|
|
|
Execute (unset g:easy_align_indentation):
|
|
unlet g:easy_align_indentation
|
|
|
|
Do (right-align around all .):
|
|
vip\<Enter>\<Enter>*.
|
|
|
|
Expect:
|
|
my_object
|
|
. method1. chain
|
|
.second_method. call
|
|
. third. call
|
|
. method_4.execute
|
|
|
|
###########################################################
|
|
|
|
Execute (define d rule):
|
|
let g:easy_align_delimiters.d =
|
|
\ { 'pattern': '\s\+\(\S\+\s*[;=]\)\@=', 'left_margin': 0, 'right_margin': 0 }
|
|
|
|
Given c (complex var dec):
|
|
const char* str = "Hello";
|
|
int64_t count = 1 + 2;
|
|
static double pi = 3.14;
|
|
static std::map<std::string, float>* scores = pointer;
|
|
|
|
Do (using d rule):
|
|
vip\<Enter>d
|
|
gv\<Enter>=
|
|
|
|
Expect c:
|
|
const char* str = "Hello";
|
|
int64_t count = 1 + 2;
|
|
static double pi = 3.14;
|
|
static std::map<std::string, float>* scores = pointer;
|
|
|
|
###########################################################
|
|
|
|
Given (indented code):
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do:
|
|
vip\<Enter>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (shallow indentation):
|
|
vip\<Enter>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (deep indentation):
|
|
vip\<Enter>\<C-I>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (no indentation):
|
|
vip\<Enter>\<C-I>\<C-I>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (right-align, shallow indentation):
|
|
vip\<Enter>\<Enter>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (center-align, shallow indentation):
|
|
vip\<Enter>\<Enter>\<Enter>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (right-align, deep indentation):
|
|
vip\<Enter>\<Enter>\<C-I>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (center-align, deep indentation):
|
|
vip\<Enter>\<Enter>\<Enter>\<C-I>\<C-I>=
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Do (right-align, no indentation):
|
|
vip\<Enter>\<Enter>\<C-I>\<C-I>\<C-I>=
|
|
|
|
###########################################################
|
|
|
|
Expect:
|
|
apple = 1
|
|
banana = 2
|
|
cake = 3
|
|
daisy = 4
|
|
eggplant = 5
|
|
|
|
Given (Center-align cases):
|
|
aaaa = 123456778901234567890 =
|
|
cccccccccccccc = 12345678 =
|
|
|
|
aaaa = 123456778901234567890 =
|
|
bbbbbb = 4
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cc = 12345678 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
bbbbbbbbbb = 12345 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 123 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaaa = 12345 =
|
|
bbbbbbbbbb = 123456778901234567890 =
|
|
|
|
aaaaa = 12345
|
|
bbbbbbbbbb = 123456778901234567890
|
|
|
|
Do:
|
|
vip\<Enter>\<Enter>\<Enter>=
|
|
}jvip\<Enter>\<Enter>\<Enter>=
|
|
}jvip\<Enter>\<Enter>\<Enter>=
|
|
}jvip\<Enter>\<Enter>\<Enter>=
|
|
}jvip\<Enter>\<Enter>\<Enter>2=
|
|
}jvip\<Enter>\<Enter>\<Enter>2=
|
|
}jvip\<Enter>\<Enter>\<Enter>2=
|
|
}jvip\<Enter>\<Enter>\<Enter>2=
|
|
}jvip\<Enter>\<Enter>\<Enter>2=
|
|
|
|
Expect:
|
|
aaaa = 123456778901234567890 =
|
|
cccccccccccccc = 12345678 =
|
|
|
|
aaaa = 123456778901234567890 =
|
|
bbbbbb = 4
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cc = 12345678 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
bbbbbbbbbb = 12345 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 123 =
|
|
|
|
aaaaa = 123456778901234567890 =
|
|
cccccccccccccccccc = 12345678 =
|
|
|
|
aaaaa = 12345 =
|
|
bbbbbbbbbb = 123456778901234567890 =
|
|
|
|
aaaaa = 12345
|
|
bbbbbbbbbb = 123456778901234567890
|
|
|
|
###########################################################
|
|
|
|
Given (long delimiter):
|
|
...-.-----
|
|
..--..----
|
|
.---...---
|
|
----....--
|
|
.---.....-
|
|
..--......
|
|
...-.....-
|
|
|
|
Do:
|
|
vip\<Enter>*\<C-X>-\+\<Enter>
|
|
|
|
Expect:
|
|
... - . -----
|
|
.. -- .. ----
|
|
. --- ... ---
|
|
---- .... --
|
|
. --- ..... -
|
|
.. -- ......
|
|
... - ..... -
|
|
|
|
Do:
|
|
vip\<Enter>*\<C-D>\<C-X>-\+\<Enter>
|
|
|
|
Expect:
|
|
... - . -----
|
|
.. -- .. ----
|
|
. --- ... ---
|
|
---- .... --
|
|
. --- ..... -
|
|
.. -- ......
|
|
... - ..... -
|
|
|
|
Do:
|
|
vip\<Enter>*\<C-D>\<C-D>\<C-X>-\+\<Enter>
|
|
|
|
Expect:
|
|
... - . -----
|
|
.. -- .. ----
|
|
. --- ... ---
|
|
---- .... --
|
|
. --- ..... -
|
|
.. -- ......
|
|
... - ..... -
|
|
|
|
Execute (set g:easy_align_delimiter_align):
|
|
let g:easy_align_delimiter_align = 'c'
|
|
|
|
Do:
|
|
vip\<Enter>*\<C-X>-\+\<Enter>
|
|
|
|
Expect:
|
|
... - . -----
|
|
.. -- .. ----
|
|
. --- ... ---
|
|
---- .... --
|
|
. --- ..... -
|
|
.. -- ......
|
|
... - ..... -
|
|
|
|
Execute (unset g:easy_align_delimiter_align):
|
|
unlet g:easy_align_delimiter_align
|
|
|
|
###########################################################
|
|
|
|
Execute (set g:easy_align_interactive_modes):
|
|
let g:easy_align_interactive_modes = ['r', 'c']
|
|
let g:easy_align_bang_interactive_modes = ['c', 'l']
|
|
|
|
Given (Test g:easy_align_interactive_modes):
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Do:
|
|
vip\<Enter>=
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Do:
|
|
vip\<Enter>\<Enter>=
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Do:
|
|
vipr\<Enter>=
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Do:
|
|
vipr\<Enter>\<Enter>=
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Do:
|
|
vipr\<Enter>\<Enter>\<Enter>=
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
|
|
Execute (unset g:easy_align_interactive_modes):
|
|
unlet g:easy_align_interactive_modes
|
|
unlet g:easy_align_bang_interactive_modes
|
|
|
|
###########################################################
|
|
|
|
Given (Test ignore_unmatched behavior):
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (left-align):
|
|
vip\<Enter>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (left-align, no ignore_unmatched):
|
|
vip\<Enter>\<C-U>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (right-align):
|
|
vip\<Enter>\<Enter>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (right-align, explicit ignore_unmatched):
|
|
vip\<Enter>\<Enter>\<C-U>\<C-U>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (center-align):
|
|
vip\<Enter>\<Enter>\<Enter>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
Do (center-align):
|
|
vip\<Enter>\<C-U>\<Enter>\<Enter>\<C-U>*=
|
|
|
|
Expect:
|
|
a = b = c
|
|
aabba = bbbbb
|
|
|
|
###########################################################
|
|
|
|
Given (test filter option):
|
|
aaa=aaa=aaa
|
|
aaaaa=aaaaa=aaaaa
|
|
aaaaaaa=aaaaaaa=aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa=aaa=aaa
|
|
|
|
Do (g/a/):
|
|
vip\<Enter>
|
|
\<C-F>g/a/\<Enter>
|
|
*=
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa = aaaaaaa = aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Do (g/a - you can omit the trailing /):
|
|
vip\<Enter>
|
|
\<C-F>g/a\<Enter>
|
|
*=
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa = aaaaaaa = aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Do (v/b/):
|
|
vip\<Enter>
|
|
\<C-F>v/b/\<Enter>
|
|
*=
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa=aaaaaaa=aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Do (invalid filter expression):
|
|
vip\<Enter>
|
|
\<C-F>haha\<Enter>
|
|
*=
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa = aaaaaaa = aaaaaaab
|
|
bbbbb = bbbbb = bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Execute (g-filter in shorthand notation):
|
|
%EasyAlign*=g/a/
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa = aaaaaaa = aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Execute (v-filter in shorthand notation):
|
|
%EasyAlign*=v/b/
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa=aaaaaaa=aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Execute (filter in dictionary format):
|
|
%EasyAlign*={'filter': 'v/b/'}
|
|
|
|
Expect:
|
|
aaa = aaa = aaa
|
|
aaaaa = aaaaa = aaaaa
|
|
aaaaaaa=aaaaaaa=aaaaaaab
|
|
bbbbb=bbbbb=bbbbb
|
|
aaa = aaa = aaa
|
|
|
|
Given clojure (filter with blockwise-visual mode):
|
|
(let [a 1
|
|
bbb 2
|
|
ccccc (range
|
|
10 20)]
|
|
(prn [a bbb ccccc]))
|
|
|
|
Do (filter with blockwise-visual mode):
|
|
f[
|
|
vi[
|
|
\<C-V>
|
|
\<Enter>
|
|
\<C-F>g/^\S\<Enter>
|
|
\<Space>
|
|
|
|
Expect clojure:
|
|
(let [a 1
|
|
bbb 2
|
|
ccccc (range
|
|
10 20)]
|
|
(prn [a bbb ccccc]))
|
|
|
|
Given clojure:
|
|
{:user {:plugins [[cider/cider-nrepl "0.9.1"]
|
|
[lein-kibit "0.0.8"]
|
|
[lein-licenses "0.1.1"]
|
|
[lein-marginalia "0.8.0"] ; lein marg
|
|
[codox "0.8.13"] ; lein doc
|
|
[com.jakemccrary/lein-test-refresh "0.10.0"] ; lein test-refresh
|
|
[lein-pprint "1.1.2"]
|
|
[lein-exec "0.3.5"]
|
|
[jonase/eastwood "0.2.1"]]
|
|
:dependencies [[slamhound "1.5.5"]]
|
|
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
|
|
:signing {:gpg-key "FEF9C627"}}}
|
|
|
|
Do (Virtual column should be used in blockwise-visual mode):
|
|
f[
|
|
vi[
|
|
\<C-V>
|
|
$20l
|
|
\<Enter>\<Space>
|
|
|
|
Expect clojure:
|
|
{:user {:plugins [[cider/cider-nrepl "0.9.1"]
|
|
[lein-kibit "0.0.8"]
|
|
[lein-licenses "0.1.1"]
|
|
[lein-marginalia "0.8.0"] ; lein marg
|
|
[codox "0.8.13"] ; lein doc
|
|
[com.jakemccrary/lein-test-refresh "0.10.0"] ; lein test-refresh
|
|
[lein-pprint "1.1.2"]
|
|
[lein-exec "0.3.5"]
|
|
[jonase/eastwood "0.2.1"]]
|
|
:dependencies [[slamhound "1.5.5"]]
|
|
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
|
|
:signing {:gpg-key "FEF9C627"}}}
|
|
|
|
###########################################################
|
|
|
|
Given (hard-tab indentation (#19)):
|
|
a=1=3
|
|
bbb=2=4
|
|
ccccc=4=5
|
|
fff=4=6
|
|
|
|
Do (Left alignment):
|
|
vip\<Enter>=
|
|
|
|
Expect:
|
|
a = 1=3
|
|
bbb = 2=4
|
|
ccccc = 4=5
|
|
fff = 4=6
|
|
|
|
Do (Right alignment):
|
|
vip\<Enter>\<Enter>=
|
|
|
|
Expect:
|
|
a = 1=3
|
|
bbb = 2=4
|
|
ccccc = 4=5
|
|
fff = 4=6
|
|
|
|
Do (Center alignment):
|
|
vip\<Enter>\<Enter>\<Enter>=
|
|
|
|
Expect:
|
|
a = 1=3
|
|
bbb = 2=4
|
|
ccccc = 4=5
|
|
fff = 4=6
|
|
|
|
Do (Left alignment with shallow indentation):
|
|
vip\<Enter>\<C-I>=
|
|
|
|
Expect:
|
|
a = 1=3
|
|
bbb = 2=4
|
|
ccccc = 4=5
|
|
fff = 4=6
|
|
|
|
Do (Center alignment with deep indentation):
|
|
vip\<Enter>\<Enter>\<Enter>\<C-I>\<C-I>=
|
|
|
|
Expect:
|
|
a = 1=3
|
|
bbb = 2=4
|
|
ccccc = 4=5
|
|
fff = 4=6
|
|
|
|
Given (hard-tab indentation - dictionary (#19)):
|
|
ddict={'homePage':'360452',
|
|
'key':'TEST',
|
|
'name':'DocumentationAPITestingSpace',
|
|
'type':'global',
|
|
'url':'http://localhost:8090/display/TEST'}
|
|
|
|
Do (Right alignment):
|
|
vip\<Enter>\<Enter>:
|
|
|
|
Expect:
|
|
ddict={'homePage': '360452',
|
|
'key': 'TEST',
|
|
'name': 'DocumentationAPITestingSpace',
|
|
'type': 'global',
|
|
'url': 'http://localhost:8090/display/TEST'}
|
|
|
|
###########################################################
|
|
|
|
Given (Two paragraphs (requires vim-repeat)):
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
dddd = 4
|
|
|
|
d = 1
|
|
cc = 2
|
|
bbb = 3
|
|
aaaa = 4
|
|
_____ = 5
|
|
|
|
Do (Align and repeat):
|
|
\<Space>Aip\<Enter>=
|
|
6G
|
|
.
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
dddd = 4
|
|
|
|
d = 1
|
|
cc = 2
|
|
bbb = 3
|
|
aaaa = 4
|
|
_____ = 5
|
|
|
|
Do (Visual-mode operator is also repeatable):
|
|
vip\<Enter>\<Enter>=
|
|
6G
|
|
.
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
dddd = 4
|
|
|
|
d = 1
|
|
cc = 2
|
|
bbb = 3
|
|
aaaa = 4
|
|
_____ = 5
|
|
|
|
Do (Repeatable in visual mode):
|
|
2GvG\<Space>.
|
|
|
|
Expect:
|
|
a = 1
|
|
bb = 2
|
|
ccc = 3
|
|
dddd = 4
|
|
|
|
d = 1
|
|
cc = 2
|
|
bbb = 3
|
|
aaaa = 4
|
|
_____ = 5
|
|
|
|
Given:
|
|
:: a : 1
|
|
:: bb : 2
|
|
:: ccc : 3
|
|
:: dd : 4
|
|
:: e : 5
|
|
|
|
:: :: a:1
|
|
:: :: b :2
|
|
:: :: ccc : 3
|
|
:: :: dd : 4
|
|
:: :: e : 5
|
|
:: :: f : 6
|
|
|
|
Do (Blockwise-visual-operator is also repeatable):
|
|
fa
|
|
\<C-V>
|
|
f1
|
|
4j
|
|
\<Enter>:
|
|
7G0
|
|
fa
|
|
.
|
|
|
|
Expect:
|
|
:: a: 1
|
|
:: bb: 2
|
|
:: ccc: 3
|
|
:: dd: 4
|
|
:: e: 5
|
|
|
|
:: :: a: 1
|
|
:: :: b: 2
|
|
:: :: ccc: 3
|
|
:: :: dd: 4
|
|
:: :: e: 5
|
|
:: :: f : 6
|
|
|
|
###########################################################
|
|
|
|
Include: include/teardown.vader
|