mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 02:43:49 -05:00
@@ -551,9 +551,7 @@ function! s:input(str, default, vis)
|
|||||||
" EasyAlign command can be called without visual selection
|
" EasyAlign command can be called without visual selection
|
||||||
redraw
|
redraw
|
||||||
endif
|
endif
|
||||||
call inputsave()
|
|
||||||
let got = input(a:str, a:default)
|
let got = input(a:str, a:default)
|
||||||
call inputrestore()
|
|
||||||
return got
|
return got
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
13
test/README.md
Normal file
13
test/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Test cases for vim-easy-align
|
||||||
|
=============================
|
||||||
|
|
||||||
|
### Prerequisite
|
||||||
|
|
||||||
|
- [Vader.vim](https://github.com/junegunn/vader.vim)
|
||||||
|
|
||||||
|
### Run
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:Vader *
|
||||||
|
```
|
||||||
|
|
||||||
1075
test/basic.expected
1075
test/basic.expected
File diff suppressed because it is too large
Load Diff
273
test/basic.md
273
test/basic.md
@@ -1,273 +0,0 @@
|
|||||||
" :source run.vim
|
|
||||||
" @a
|
|
||||||
|
|
||||||
Paul McCartney 1942
|
|
||||||
George Harrison 1943
|
|
||||||
Ringo Starr 1940
|
|
||||||
Pete Best 1941
|
|
||||||
|
|
||||||
| 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 |
|
|
||||||
|
|
||||||
aaa, bb,c
|
|
||||||
d,eeeeeee
|
|
||||||
fffff, gggggggggg,
|
|
||||||
h, , ii
|
|
||||||
j,,k
|
|
||||||
|
|
||||||
```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
|
|
||||||
|
|
||||||
options = { :caching => nil,
|
|
||||||
:versions => 3,
|
|
||||||
"cache=blocks" => false }.merge(options)
|
|
||||||
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
|
|
||||||
# let g:easy_align_delimiters = { '#': { 'pattern': '#\+', 'ignores': ['String'] } }
|
|
||||||
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
apricot = 'DAD' + 'F#AD'
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
|
|
||||||
mysql:
|
|
||||||
# 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
|
|
||||||
|
|
||||||
```
|
|
||||||
```c
|
|
||||||
|
|
||||||
/* a */ b = c
|
|
||||||
aa >= bb
|
|
||||||
// aaa = bbb = cccc
|
|
||||||
/* aaaa = */ bbbb === cccc " = dddd = " = eeee
|
|
||||||
aaaaa /* bbbbb */ == ccccc /* != eeeee = */ === fffff
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
my_object
|
|
||||||
.method1.chain
|
|
||||||
.second_method.call
|
|
||||||
.third.call
|
|
||||||
.method_4.execute
|
|
||||||
|
|
||||||
my_object.
|
|
||||||
method1.chain.
|
|
||||||
second_method.call.
|
|
||||||
third.call.
|
|
||||||
method_4.execute
|
|
||||||
|
|
||||||
| 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 |
|
|
||||||
|
|
||||||
|
|
||||||
```c
|
|
||||||
|
|
||||||
const char* str = "Hello";
|
|
||||||
int64_t count = 1 + 2;
|
|
||||||
static double pi = 3.14;
|
|
||||||
static std::map<std::string, float>* scores = pointer;
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Paul McCartney 1942
|
|
||||||
George Harrison 1943
|
|
||||||
Ringo Starr 1940
|
|
||||||
Pete Best 1941
|
|
||||||
|
|
||||||
...-.-----
|
|
||||||
..--..----
|
|
||||||
.---...---
|
|
||||||
----....--
|
|
||||||
.---.....-
|
|
||||||
..--......
|
|
||||||
...-.....-
|
|
||||||
|
|
||||||
apple = 1
|
|
||||||
banana = 2
|
|
||||||
cake = 3
|
|
||||||
daisy = 4
|
|
||||||
eggplant = 5
|
|
||||||
|
|
||||||
|
|
||||||
```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";
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
|
|
||||||
a =
|
|
||||||
a = 1
|
|
||||||
bbbb .= 2
|
|
||||||
ccccccc = 3
|
|
||||||
ccccccccccccccc
|
|
||||||
# eeeeeeeeeeeeeeee
|
|
||||||
e # asdf
|
|
||||||
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
|
|
||||||
|
|
||||||
a = 1
|
|
||||||
bb = 22
|
|
||||||
ccc = 333
|
|
||||||
dddd = "asdf"
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
a a a a a
|
|
||||||
bbb bbb bbb bbb bbb
|
|
||||||
ccccc ccccc ccccc ccccc ccccc
|
|
||||||
d ddd dddd ddd d
|
|
||||||
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
bbbbbbbbbb = 12345 =
|
|
||||||
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc = 123 =
|
|
||||||
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
aaaaa = 12345 =
|
|
||||||
bbbbbbbbbb = 123456778901234567890 =
|
|
||||||
|
|
||||||
aaaaa = 12345
|
|
||||||
bbbbbbbbbb = 123456778901234567890
|
|
||||||
|
|
||||||
123456 789
|
|
||||||
1234567890 1
|
|
||||||
|
|
||||||
1234 56
|
|
||||||
123456 7890
|
|
||||||
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
```
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc =12345678 =
|
|
||||||
|
|
||||||
aaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
aaaaaaaaaaaaa = 123456778901234567890 =
|
|
||||||
cc = 12345678 =
|
|
||||||
|
|
||||||
aaaaaaaaaaa= 123
|
|
||||||
a = 123
|
|
||||||
|
|
||||||
aaaaaaaaaaaa= 123
|
|
||||||
a = 123
|
|
||||||
|
|
||||||
aaaaaaaaaaaa = 123
|
|
||||||
aaaaaaaaaaa = 123
|
|
||||||
aaaaaaaaaa = 123
|
|
||||||
aaa = 123
|
|
||||||
aa = 123
|
|
||||||
a = 123
|
|
||||||
|
|
||||||
aaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
aaaa = 123456778901234567890 =
|
|
||||||
bbbbbb = 4
|
|
||||||
cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
aaaa = 123456778901234567890 =
|
|
||||||
cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
aaaaa = 123456778901234567890 =
|
|
||||||
cc = 12345678 =
|
|
||||||
|
|
||||||
=aaaaa = 123456778901234567890 =
|
|
||||||
= cccccccccccccccccc = 12345678 =
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
a,,bbb
|
|
||||||
aa,,bb
|
|
||||||
aaa,,b
|
|
||||||
aaaa,,
|
|
||||||
aaa,b,
|
|
||||||
aa,bb,
|
|
||||||
a,bbb,
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
4Gvipjyvip
|
|
||||||
157
test/commandline.vader
Normal file
157
test/commandline.vader
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
Execute (Clean up test environment):
|
||||||
|
let g:easy_align_delimiters = {}
|
||||||
|
silent! unlet g:easy_align_ignore_groups
|
||||||
|
silent! unlet g:easy_align_ignore_unmatched
|
||||||
|
silent! unlet g:easy_align_indentation
|
||||||
|
silent! unlet g:easy_align_delimiter_align
|
||||||
|
|
||||||
|
Given (fruits):
|
||||||
|
apple;:;;banana::cake
|
||||||
|
data;;exchange:;::format
|
||||||
|
|
||||||
|
Execute (regular expression):
|
||||||
|
%EasyAlign/[:;]\+/
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple ;:;; banana::cake
|
||||||
|
data ;; exchange:;::format
|
||||||
|
|
||||||
|
Execute (options dictionary):
|
||||||
|
%EasyAlign/[:;]\+/{ 'left_margin': '<', 'right_margin': 3 }
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple<;:;; banana::cake
|
||||||
|
data < ;; exchange:;::format
|
||||||
|
|
||||||
|
Execute (fuzzy matching):
|
||||||
|
%EasyAlign/[:;]\+/{ 'l':'<', 'r': '>'}
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple<;:;;>banana::cake
|
||||||
|
data < ;;>exchange:;::format
|
||||||
|
|
||||||
|
Execute (shorthand notation of margin):
|
||||||
|
%EasyAlign/[:;]\+/l0r0
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple;:;;banana::cake
|
||||||
|
data ;;exchange:;::format
|
||||||
|
|
||||||
|
Execute (delimiter align):
|
||||||
|
%EasyAlign*/[:;]\+/l0r0dc
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple;:;;banana :: cake
|
||||||
|
data ;; exchange:;::format
|
||||||
|
|
||||||
|
Execute (shorthand notation of mode_sequence and margin):
|
||||||
|
%EasyAlign/[:;]\+/mrc*l2r2
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple ;:;; banana :: cake
|
||||||
|
data ;; exchange :;:: format
|
||||||
|
|
||||||
|
Execute (deep indentation):
|
||||||
|
%EasyAlign/[:;]\+/mrc*l2r2
|
||||||
|
%EasyAlign*/[:;]\+/idmrl*
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple ;:;; banana :: cake
|
||||||
|
data ;; exchange :;:: format
|
||||||
|
|
||||||
|
Execute (stick_to_left):
|
||||||
|
%EasyAlign*/[:;]\+/stl1l0dlrm3
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple;:;; banana:: cake
|
||||||
|
data;; exchange:;:: format
|
||||||
|
|
||||||
|
Execute (different regular expression):
|
||||||
|
%EasyAlign*/../{'lm':'<','rm':'>'}
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e
|
||||||
|
da><ta><;;><ex><ch><an><ge><:;><::><fo><rm><at
|
||||||
|
|
||||||
|
Execute (merge different option notations):
|
||||||
|
%EasyAlign*/../iu0 { 'l': '<', 'r': '>' }
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e<
|
||||||
|
da><ta><;;><ex><ch><an><ge><:;><::><fo> <rm><at<
|
||||||
|
|
||||||
|
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"
|
||||||
|
};
|
||||||
|
|
||||||
|
Execute (default syntax-aware alignment):
|
||||||
|
%EasyAlign*:
|
||||||
|
|
||||||
|
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 (do not ignore unmatched):
|
||||||
|
%EasyAlign*:iu0
|
||||||
|
|
||||||
|
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 (do not ignore any group):
|
||||||
|
%EasyAlign*:ig[]iu0
|
||||||
|
|
||||||
|
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 (ignore only strings):
|
||||||
|
%EasyAlign*:ig['String']
|
||||||
|
|
||||||
|
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 (ignore only comments):
|
||||||
|
%EasyAlign*:ig['Comment']
|
||||||
|
|
||||||
|
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"
|
||||||
|
};
|
||||||
|
|
||||||
1237
test/interactive.vader
Normal file
1237
test/interactive.vader
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,128 +0,0 @@
|
|||||||
" :source run.vim
|
|
||||||
" @a
|
|
||||||
|
|
||||||
apple;:banana :: cake
|
|
||||||
data;;exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;:____banana::cake
|
|
||||||
data ;;____exchange:;format
|
|
||||||
|
|
||||||
apple ; : banana : : cake
|
|
||||||
data ; ; exchange : ; format
|
|
||||||
|
|
||||||
ap pl e; :b an an a: :c ak e
|
|
||||||
da ta ;; ex ch an ge :; fo rm at
|
|
||||||
|
|
||||||
ap ple;:banana::cake
|
|
||||||
da ta;;exchange:;format
|
|
||||||
|
|
||||||
apple???;:~~~banana???::~~~ cake
|
|
||||||
data???;;~~~ exchange???:;~~~format
|
|
||||||
|
|
||||||
apple;: banana::cake
|
|
||||||
data;; exchange:;format
|
|
||||||
|
|
||||||
apple<<<;:>>>banana::cake
|
|
||||||
data <<<;;>>>exchange:;format
|
|
||||||
|
|
||||||
apple ;: banana::cake
|
|
||||||
data ;; exchange:;format
|
|
||||||
|
|
||||||
apple;:banana :: cake
|
|
||||||
data;;exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple ;: banana::cake
|
|
||||||
data ;; exchange:;format
|
|
||||||
|
|
||||||
apple ; :banana::cake
|
|
||||||
data ; ; exchange: ; format
|
|
||||||
|
|
||||||
apple ; :banana::cake
|
|
||||||
data ; ;exchange:;format
|
|
||||||
|
|
||||||
apple ; :banana::cake
|
|
||||||
data ; ;exchange:;format
|
|
||||||
|
|
||||||
apple;:banana::cake
|
|
||||||
data;;exchange:;format
|
|
||||||
|
|
||||||
apple;: banana: : cake
|
|
||||||
data;;exchange: ;format
|
|
||||||
|
|
||||||
apple;:banana: :cake
|
|
||||||
data;;exchange:;format
|
|
||||||
|
|
||||||
apple;:banana: :cake
|
|
||||||
data;;exchange:;format
|
|
||||||
|
|
||||||
apple;: banana: : cake
|
|
||||||
data;;exchange: ;format
|
|
||||||
|
|
||||||
apple;:banana:: cake
|
|
||||||
data;;exchange: ;format
|
|
||||||
|
|
||||||
apple;: banana: : cake
|
|
||||||
data;;exchange: ;format
|
|
||||||
|
|
||||||
apple;: banana::cake
|
|
||||||
data;;exchange: ;format
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
apricot = 'DAD' + 'F#AD'
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
```
|
|
||||||
|
|
||||||
a()p()p()l()e();():()b()a()n()a()n()a():():()c()a()k()e(
|
|
||||||
d()a()t()a();();()e()x()c()h()a()n()g()e():();()f()o()r()m()a()t(
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;;exchange :;format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
apple;:banana ::cake
|
|
||||||
data ;;exchange:;format
|
|
||||||
|
|
||||||
apple ;: banana :: cake
|
|
||||||
data ;; exchange :; format
|
|
||||||
|
|
||||||
a+= 1
|
|
||||||
bb==# 2
|
|
||||||
ccc= 3
|
|
||||||
dddd=> 4
|
|
||||||
|
|
||||||
apple;: banana:: cake
|
|
||||||
data;; exchange:; format
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
apricot = 'DAD' + 'F#AD'
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
```
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
apricot = 'DAD' + 'F#AD'
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
" :source run.vim
|
|
||||||
" @a
|
|
||||||
|
|
||||||
apple;:banana::cake
|
|
||||||
data;;exchange:;format
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
apple = 1 # comment not aligned
|
|
||||||
apricot = 'DAD' + 'F#AD'
|
|
||||||
banana = 'Gros Michel' # comment 2
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
4Gvipjyvip:EasyAlign:
|
|
||||||
51
test/run.vim
51
test/run.vim
@@ -1,51 +0,0 @@
|
|||||||
e!
|
|
||||||
|
|
||||||
function! GFM()
|
|
||||||
let syntaxes = {
|
|
||||||
\ 'ruby': 'syntax/ruby.vim',
|
|
||||||
\ 'yaml': 'syntax/yaml.vim',
|
|
||||||
\ 'vim': 'syntax/vim.vim',
|
|
||||||
\ 'sh': 'syntax/sh.vim',
|
|
||||||
\ 'python': 'syntax/python.vim',
|
|
||||||
\ 'java': 'syntax/java.vim',
|
|
||||||
\ 'c': 'syntax/c.vim'
|
|
||||||
\ }
|
|
||||||
|
|
||||||
for [lang, syn] in items(syntaxes)
|
|
||||||
unlet b:current_syntax
|
|
||||||
silent! exec printf("syntax include @%s %s", lang, syn)
|
|
||||||
exec printf("syntax region %sSnip matchgroup=Snip start='```%s' end='```' contains=@%s",
|
|
||||||
\ lang, lang, lang)
|
|
||||||
endfor
|
|
||||||
let b:current_syntax='mkd'
|
|
||||||
|
|
||||||
syntax sync fromstart
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
silent! unlet g:easy_align_delimiters
|
|
||||||
silent! unlet g:easy_align_ignore_unmatched
|
|
||||||
silent! unlet g:easy_align_ignores
|
|
||||||
|
|
||||||
vnoremap <silent> <Enter> :EasyAlign<cr>
|
|
||||||
|
|
||||||
noremap <silent> <C-k> <nop>
|
|
||||||
noremap <silent> <C-j> <nop>
|
|
||||||
noremap <silent> <C-h> <nop>
|
|
||||||
noremap <silent> <C-l> <nop>
|
|
||||||
vnoremap <silent> <C-k> <nop>
|
|
||||||
vnoremap <silent> <C-j> <nop>
|
|
||||||
vnoremap <silent> <C-h> <nop>
|
|
||||||
vnoremap <silent> <C-l> <nop>
|
|
||||||
|
|
||||||
set nolazyredraw
|
|
||||||
set buftype=nofile
|
|
||||||
set colorcolumn=
|
|
||||||
|
|
||||||
silent! ScrollPositionHide
|
|
||||||
|
|
||||||
call GFM()
|
|
||||||
|
|
||||||
normal gg
|
|
||||||
let @b=system('cat '. expand('%:p:r') . '.script')
|
|
||||||
let @a='@b:vert diffsplit ' . expand('%:p:r') . '.expected
|
|
||||||
'
|
|
||||||
Reference in New Issue
Block a user