File: plugin_Align.vim.html

package info (click to toggle)
vim-scripts 20130814
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,608 kB
  • ctags: 2,511
  • sloc: perl: 452; xml: 95; makefile: 25
file content (382 lines) | stat: -rw-r--r-- 16,648 bytes parent folder | download | duplicates (6)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
  <link rel="Stylesheet" type="text/css" href="/css/style.css" >
  <title>Align - Provides commands and maps to help produce aligned text, eqns, declarations, etc : vim online</title>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <meta name="KEYWORDS" content="Vim, Vi IMproved, text editor, home, documentation, tips, scripts, news">
  <link rel="shortcut icon" type="image/x-icon" href="/images/vim_shortcut.ico">
</head>

<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff"> 

<!-- HEADER, SPONSOR IMAGE, VIM IMAGE AND BOOK AD -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
  <tr>
    <td colspan="4" class="lightbg"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
  </tr>
  <tr>
  <td class="lightbg">&nbsp;&nbsp;&nbsp;</td>
  <td class="lightbg" align="left"><a href="/sponsor/index.php"><img src="/images/sponsorvim.gif" alt="sponsor Vim development" border="0"></a></td>
    <td class="lightbg" align="center"><a href="/index.php"><img src="/images/vim_header.gif" border="0" alt="Vim logo"></a></td>
    <td class="lightbg" align="right"><a href="http://iccf-holland.org/click5.html"><img src="/images/buyhelplearn.gif" alt="Vim Book Ad" border="0"></a></td>
  </tr>
  <tr>
    <td colspan="4" class="lightbg"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
  </tr>
  <tr>
    <td colspan="4" class="darkbg"><img src="/images/spacer.gif" width="1" height="10" alt=""></td>
  </tr>
</table>
<!-- THE PAGE BODY: BETWEEN HEADER AND FOOTER -->

<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <col width="180">
  <col width="1">

  <tr valign="top">
    <td class="sidebar">
      <table width="180" cellpadding="4" cellspacing="0" border="0">
        <tr valign="top">
          <td class="sidebar">

<!-- INCLUDE THE PAGE NAVIGATION -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
    <tr>
        <td><small>not logged in (<a href="/login.php">login</a>)</small></td>
    </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="1"></td>
    </tr>
    <tr>
        <td class="darkbg"><img src="/images/spacer.gif" alt='' border="0" height="3"></td>
    </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="2"></td>
    </tr>
        <tr>
            <td class="sidebarheader"><a href="/index.php">Home</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/search.php">Search</a></td>
        </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
    <tr>
        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
    </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
        <tr>
            <td class="sidebarheader"><a href="/about.php">About Vim</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/community.php">Community</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/news/news.php">News</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/sponsor/index.php">Sponsoring</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/trivia.php">Trivia</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/docs.php">Documentation</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/download.php">Download</a></td>
        </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
    <tr>
        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
    </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
        <tr>
            <td class="sidebarheader"><a href="/scripts/index.php">Scripts</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/tips/index.php">Tips</a></td>
        </tr>
        <tr>
            <td class="sidebarheader"><a href="/account/index.php">My Account</a></td>
        </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
    <tr>
        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
    </tr>
    <tr>
        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
    </tr>
        <tr>
            <td class="sidebarheader"><a href="/huh.php">Site Help</a></td>
        </tr>
</table>

            <table width="172" cellpadding="0" cellspacing="0" border="0">
              <tr><td><img src="/images/spacer.gif" alt="" border="0" width="1" height="8"></td></tr>
              <tr><td class="darkbg"><img src="/images/spacer.gif" width="1" height="3" alt=""></td></tr>
            </table>
            <br>

<!-- INCLUDE THE PAGE SIDEBAR TEXT -->
&nbsp;

          </td>
        </tr>
      </table>
    </td>

    <td class="darkbg"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""><br></td>
    <td>
      <table width="100%" cellpadding="10" cellspacing="0" border="0" bordercolor="red">
        <tr>
          <td valign="top">

<span class="txth1">Align : Provides commands and maps to help produce aligned text, eqns, declarations, etc</span> 

<br>
<br>

<!-- karma table -->
<table cellpadding="4" cellspacing="0" border="1" bordercolor="#000066">
<tr>
  <td class="lightbg"><b>&nbsp;script karma&nbsp;</b></td>
  <td>
    Rating <b>528/165</b>,
    Downloaded by 4114  </td>
</tr>
</table>
<p>

<table cellspacing="0" cellpadding="0" border="0">
<tr><td class="prompt">created by</td></tr>
<tr><td><a href="/account/profile.php?user_id=96">Charles Campbell</a></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td class="prompt">script type</td></tr>
<tr><td>utility</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td class="prompt">description</td></tr>
<tr><td>Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc.&nbsp;&nbsp;There are two basic commands provided by this package:
<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AlignCtrl options sep1 sep2 sep3 ...
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[range]Align sep1 sep2 sep3 ...
<br>
<br>The &quot;sep#&quot; are regular expressions which describe separators that delineate fields; Align will line up the separators. The range may be any Vim range, _including_ visual-blocks.&nbsp;&nbsp;Align works on lines of&nbsp;&nbsp;the form:
<br>(ws==whitespace)
<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br>&nbsp;&nbsp;&nbsp;&nbsp;ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br>
<br>Note that white-space (ws) surrounding separators is ignored.
<br>
<br>There are several options to help with deciding what to do with initial white space.&nbsp;&nbsp; By default Align re-uses the first line's initial white space, but one may use AlignCtrl to retain or remove each line's initial white space.
<br>
<br>Align handles alignment on multiple separators, not just the first one, and the separators may be the same across the line or different.
<br>
<br>The &lt;Align.vim&gt; and &lt;AlignMaps.vim&gt; files are plugins and require vim 6.1 or higher.
<br>
<br>EXAMPLES:
<br>
<br>:5,10Align =
<br>&nbsp;&nbsp;&nbsp;&nbsp;Align on '=' signs
<br>
<br>:'&lt;,'&gt;Align = + - \* /
<br>&nbsp;&nbsp;&nbsp;&nbsp;Align on any of the five separator characters shown.
<br>&nbsp;&nbsp;&nbsp;&nbsp;Note that visual block mode was used to fire off Align.
<br>
<br>:AlignCtrl =lp1P1I
<br>&nbsp;&nbsp;&nbsp;&nbsp;which means:
<br>&nbsp;&nbsp;&nbsp;&nbsp;= all separators are equivalent
<br>&nbsp;&nbsp;&nbsp;&nbsp;l fields will be left-justified
<br>&nbsp;&nbsp;&nbsp;&nbsp;p1 pad one space before each separator
<br>&nbsp;&nbsp;&nbsp;&nbsp;P1 pad one space after each separator
<br>&nbsp;&nbsp;&nbsp;&nbsp;I&nbsp;&nbsp;preserve and apply the first line's leading white space to all
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Align'd lines
<br>
<br>:help align
<br>&nbsp;&nbsp;&nbsp;&nbsp;Gives help for Align
<br>
<br>ALIGNMENT CONTROL
<br>
<br>Alignment control allows for left or right justification or centering of fields, cyclic (sequentially active) or equivalent (simultaneously active) regular expressions to specify field separators, initial white space control, optional visual-block use (ie. apply Alignment only within a block), user-specified white-space padding about separators, and multiple separators.
<br>
<br>MANY ALIGNMENT MAPS
<br>
<br>AlignMaps.vim provides a number of maps which make using this package easy.&nbsp;&nbsp;They typically either apply to the range 'a,. (from mark a to current line) or use the visual-selection (V, v, or ctrl-v selected):
<br>
<br>	\t=&nbsp;&nbsp;: align assignments (don't count logic, like == or !=)
<br>	\t,&nbsp;&nbsp;: align on commas
<br>	\t|&nbsp;&nbsp;: align on vertical bars (|)
<br>	\tsp : align on whitespace
<br>	\tt&nbsp;&nbsp;: align LaTeX tabular tables
<br>
<br>AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments:
<br>
<br>	\acom : align comments
<br>	\adec : align C declarations (one variable per line)
<br>	\afnc : align ansi-style C function input arguments
<br>	\Htd&nbsp;&nbsp;: align html tables
<br>	
<br>To see some examples of this, check out
<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;<a target="_blank" href="http://mysite.verizon.net/astronaut/vim/textab.html#Examples">http://mysite.verizon.net/astronaut/vim/textab.html#Examples</A>
<br>
<br>(the proportional fonts used by most browsers in showing you this page preclude showing the examples here). The help for Align and AlignCtrl also contains many examples.
<br>
<br>ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL
<br>
<br>Sometimes one wants to align only a subset of text in a range, based on patterns or column extents.&nbsp;&nbsp;Align supports both types of restrictions!
<br>&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;Visual-block selection may be used to restrict Align to operate only
<br>&nbsp;&nbsp;&nbsp;&nbsp;within that visual block.
<br>&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;AlignCtrl supports &quot;g&quot; and &quot;v&quot; patterns that restrict Align to
<br>&nbsp;&nbsp;&nbsp;&nbsp;operate on lines which match (or don't match, respectively) those
<br>&nbsp;&nbsp;&nbsp;&nbsp;patterns.
<br>
<br>NEW STUFF:
<br>
<br>There's a number of new AlignCtrl options:
<br>&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;- allows one to skip a separator (treat it as part of a field)
<br>&nbsp;&nbsp;&nbsp;&nbsp;+ repeat the last lrc justification (ex. lr+ == lrrrrrr... )
<br>&nbsp;&nbsp;&nbsp;&nbsp;: treat the rest of the line as a field; acts as a modifier
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to the last lrc. 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt; left-justify the separator
<br>&nbsp;&nbsp;&nbsp;&nbsp;&gt; right-justify the separator
<br>&nbsp;&nbsp;&nbsp;&nbsp;| center the separator
<br>
<br>These are, except for the &quot;:&quot;, cyclic parameters.&nbsp;&nbsp;In other words, &gt;&lt; is equivalent to &gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;... .&nbsp;&nbsp;Thus separators can be of differing lengths (ex.&nbsp;&nbsp;-\+ as a separator pattern can match -, --, ---, etc and the separators will be left/right/center justified as you wish).
<br>
<br>To get some automatic aligning of = in the C and vimL languages, check out script#884 for two ftplugins (which use Align).
<br>
<br>
<br>Alternative Aligners:
<br>&nbsp;&nbsp;&nbsp;&nbsp;Gergely Kontra's <a href="/scripts/script.php?script_id=176">vimscript#176</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;Johannes Zellner's <a target="_blank" href="http://www.zellner.org/vim/autoload/">http://www.zellner.org/vim/autoload/</A>
<br>&nbsp;&nbsp;&nbsp;&nbsp;Mohsin Ahmed's <a href="/tips/tip.php?tip_id=570">vimtip#570</a>
<br>
<br>Thank you for rating Align!
<br>
<br>---------------------------------------
<br>DISCUSSION and COMMENTS:
<br>---------------------------------------
<br>
<br>Use <a href="/tips/tip.php?tip_id=139">vimtip#139</a> for discussion and comments.&nbsp;&nbsp;Please use email for bugs.&nbsp;&nbsp;Enjoy!
<br>
<br></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td class="prompt">install details</td></tr>
<tr><td>1. Put &lt;Align.tar.gz&gt; in your .vim or _vimfiles directory.
<br>2. gunzip Align.tar.gz
<br>3. tar -oxvf Align.tar
<br>
<br>Result: plugin/Align.vim
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;plugin/AlignMaps.vim
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc/Align.txt
<br>4. Fire up vim or gvim, then
<br>&nbsp;&nbsp;&nbsp;&nbsp; :helptags ..path../.vim/doc
<br>-or- : helptags ..path\_vimfiles\doc
<br>5. Align needs vim v6.1 or later
<br></td></tr>
<tr><td>&nbsp;</td></tr>
</table>

<!-- rating table -->
<form name="rating">
<input type="hidden" name="script_id" value="294">
<table cellpadding="4" cellspacing="0" border="1" bordercolor="#000066">
<tr>
  <td class="lightbg"><b>rate this script</b></td>
  <td valign="middle">
    <input type="radio" name="rating" value="life_changing">Life Changing
    <input type="radio" name="rating" value="helpful">Helpful
    <input type="radio" name="rating" value="unfulfilling">Unfulfilling&nbsp;
    <input type="submit" value="rate">
  </td>
</tr>
</table>
</form>
<span class="txth2">script versions</span> (<a href="add_script_version.php?script_id=294">upload new version</a>)
<p>
Click on the package to download.
<p>

<table cellspacing="2" cellpadding="4" border="0" width="100%">
<tr class='tableheader'>
        <th valign="top">package</th>
    <th valign="top">script version</th>
    <th valign="top">date</th>
    <th valign="top">Vim version</th>
    <th valign="top">user</th>
    <th valign="top">release notes</th>
</tr>
<tr>
        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=4167">Align.tar.gz</a></td>
    <td class="rowodd" valign="top" nowrap><b>27/31</b></td>
    <td class="rowodd" valign="top" nowrap><i>2005-04-15</i></td>
    <td class="rowodd" valign="top" nowrap>6.0</td>
    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=96">Charles Campbell</a></i></td>
    <td class="rowodd" valign="top" width="2000">Align: GetLatestVimScripts/AutoInstall supported
<br>AlignMaps: new map: \\adcom (align declaration-style comments), \\a, now wors across multiple lines with different types, cecutil.vim now used, more number alignment maps (\\aenum, \\aunum)
<br></td>
</tr>
</table>
<!-- finish off the framework -->
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

<!-- END OF THE PAGE BODY: BETWEEN HEADER AND FOOTER -->

<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td></tr>
  <tr><td colspan="4" bgcolor="#000000"><img src="/images/spacer.gif" height="2" width="1" alt=""></td></tr>
  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td></tr>
  <tr>
    <td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>

    <td align="left" valign="top"><small>
      If you have questions or remarks about this site, visit the
      <a href="http://vimonline.sf.net">vimonline development</a> pages.
      Please use this site responsibly.
      <br> 
      
      Questions about <a href="http://www.vim.org/about.php">Vim</a> should go
      to vim@vim.org after searching
      <a href="http://groups.yahoo.com/group/vim">the archive</a>.
      Help Bram <a href="http://iccf-holland.org/">help Uganda</a>.
      </small>
    </td>

    <td align="right" valign="top">
      	<a href="http://www.webconceptgroup.net"><img src="/images/logo_sponsor_wcg.jpg" width="131" height="30" border="0" alt="Sponsored by Web Concept Group Inc."></a>
	<a href="http://sflogo.sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge Logo"></a>
    </td>

    <td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>
  </tr>

    
  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
  
  </tr>
</table>

</body>
</html>