File: tex.vader

package info (click to toggle)
vim-easy-align 2.10.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: sh: 9; makefile: 2
file content (158 lines) | stat: -rw-r--r-- 4,564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# http://en.wikibooks.org/wiki/LaTeX/Tables

Include: include/setup.vader

Given tex (table with escaped &):
  \begin{tabular}{ l c r }
    1&2&3\\
    44&55&66\\
    777&8\&8&999\\
  \end{tabular}

# FIXME vip doesn't work if folded
Do (Align around all &s and \\s):
  VG\<Enter>*&

Expect tex:
  \begin{tabular}{ l c r }
    1   & 2    & 3   \\
    44  & 55   & 66  \\
    777 & 8\&8 & 999 \\
  \end{tabular}

Do (right-align with explicit ignore_unmatched):
  VG\<Enter>\<Enter>\<C-U>\<C-U>*&

Expect tex:
  \begin{tabular}{ l c r }
      1 &    2 &   3 \\
     44 &   55 &  66 \\
    777 & 8\&8 & 999 \\
  \end{tabular}

Do (center-align with explicit ignore_unmatched):
  VG\<Enter>\<Enter>\<Enter>\<C-U>\<C-U>*&

Expect tex:
  \begin{tabular}{ l c r }
     1  &  2   &  3  \\
    44  &  55  & 66  \\
    777 & 8\&8 & 999 \\
  \end{tabular}

Given tex (simple table with \hline):
  \begin{tabular}{ l c r }
    1&2&3\\ \hline
    44&55&66\\ \hline
    777&8\&&999\\ \hline
  \end{tabular}

Do:
  VG\<Enter>*&

Expect tex:
  \begin{tabular}{ l c r }
    1   & 2   & 3   \\ \hline
    44  & 55  & 66  \\ \hline
    777 & 8\& & 999 \\ \hline
  \end{tabular}

Given tex (table with lines w/o &s):
  \begin{tabular}{|r|l|}
    \hline
    7C0 & hexadecimal \\
    3700&octal \\ \cline{2-2}
    1111100000 & binary \\
    \hline \hline
    1984 & decimal \\
    \hline
  \end{tabular}

Do (left-align*):
  VG\<Enter>*&

Expect tex:
  \begin{tabular}{|r|l|}
    \hline
    7C0        & hexadecimal \\
    3700       & octal       \\ \cline{2-2}
    1111100000 & binary      \\
    \hline \hline
    1984       & decimal     \\
    \hline
  \end{tabular}

Do(left-align* and right-align around 2nd):
  VG\<Enter>*&
  gv\<Enter>\<Enter>2&

Expect tex:
  \begin{tabular}{|r|l|}
    \hline
    7C0        & hexadecimal \\
    3700       &       octal \\ \cline{2-2}
    1111100000 &      binary \\
    \hline \hline
    1984       &     decimal \\
    \hline
  \end{tabular}

Given tex:
  \begin{tabular}{}
    32&1.14\e1&&5.65\e2&&&&1.16\e1&&1.28\e1&\\
    64&1.03\e1&0.1&4.98\e2&0.2&&&9.21\e2&0.3&1.02\e1&0.3\\
    128&9.86\e2&0.1&4.69\e2&0.1&&&8.46\e2&0.1&9.45\e2&0.1\\
    256&9.65\e2&0.0&4.59\e2&0.0&&&8.15\e2&0.1&9.11\e2&0.1\\
  % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
    1024&9.49\e2&0.0&4.53\e2&0.0&&&7.94\e2&0.0&8.89\e2&0.0\\
    2048&9.47\e2&0.0&4.52\e2&0.0&&&7.91\e2&0.0&8.85\e2&0.0\\
    4096&9.46\e2&0.0&4.51\e2&0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
    8192&9.45\e2&0.0&4.51\e2&0.0&&&&&&\\
  \end{tabular}

Execute (Alignment around &s, foldmethod should not change):
  setlocal foldmethod=syntax
  %EasyAlign*&
  AssertEqual 'syntax', &l:foldmethod

  setlocal foldmethod=manual
  %EasyAlign*&
  AssertEqual 'manual', &l:foldmethod

Expect tex:
  \begin{tabular}{}
    32   & 1.14\e1 &     & 5.65\e2 &     &  &  & 1.16\e1 &     & 1.28\e1 &     \\
    64   & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 &  &  & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
    128  & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 &  &  & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
    256  & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 &  &  & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
  % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
    1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 &  &  & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
    2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 &  &  & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
    4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
    8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 &  &  &         &     &         &     \\
  \end{tabular}

Execute (g:easy_align_bypass_fold set, foldmethod should not change):
  let g:easy_align_bypass_fold = 1
  setlocal foldmethod=syntax
  %EasyAlign*&
  AssertEqual 'syntax', &l:foldmethod

  setlocal foldmethod=manual
  %EasyAlign*&
  AssertEqual 'manual', &l:foldmethod

Expect tex:
  \begin{tabular}{}
    32   & 1.14\e1 &     & 5.65\e2 &     &  &  & 1.16\e1 &     & 1.28\e1 &     \\
    64   & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 &  &  & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
    128  & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 &  &  & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
    256  & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 &  &  & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
  % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
    1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 &  &  & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
    2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 &  &  & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
    4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
    8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 &  &  &         &     &         &     \\
  \end{tabular}

Include: include/teardown.vader