File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ function! s:TableFormat()
550
550
" Move colons for alignment to left or right side of the cell.
551
551
execute ' s/:\( \+\)|/\1:|/e' . l: flags
552
552
execute ' s/|\( \+\):/|:\1/e' . l: flags
553
- execute ' s/ /- /' . l: flags
553
+ execute ' s/|:\?\zs[ -]\+\ze:\?|/\=repeat("-", len(submatch(0))) /' . l: flags
554
554
call setpos (' .' , l: pos )
555
555
endfunction
556
556
Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ Expect (table is not modified):
30
30
|---|---|
31
31
| c | d |
32
32
33
+ Given markdown (indented table);
34
+ | a | b |
35
+ |---|---|
36
+ | c | d |
37
+
38
+ Execute (format well formatted, indented table):
39
+ TableFormat
40
+
41
+ Expect (table is not modified):
42
+ | a | b |
43
+ |---|---|
44
+ | c | d |
45
+
33
46
Given markdown;
34
47
| left |right| center ||
35
48
| :- | --: |:---:|:|
@@ -42,3 +55,16 @@ Expect (preserve colons to align text):
42
55
| left | right | center | |
43
56
|:-----|------:|:------:|:--|
44
57
| left | right | center | |
58
+
59
+ Given markdown (indented table with colons);
60
+ | left |right| center ||
61
+ | :- | --: |:---:|:|
62
+ | left |right| center ||
63
+
64
+ Execute (format indented table with colons):
65
+ TableFormat
66
+
67
+ Expect (preserve colons to align text):
68
+ | left | right | center | |
69
+ |:-----|------:|:------:|:--|
70
+ | left | right | center | |
You can’t perform that action at this time.
0 commit comments