sponsor Vim development Vim logo Vim Book Ad

Tabbi : Aligns text as a table

 script karma  Rating 35/16, Downloaded by 1014  Comments, bugs, improvements  Vim wiki

created by
Daniel Schemala
 
script type
utility
 
description
A simple vim plugin that aligns text separated with tabs or two or more whitespaces, so that each part starts in the same column as in the other lines. Similar as a table, but without lines.

Before:
part one        part two     part three
another part one              another part two    another part three

After:
part one                  part two                 part three
another part one    another part two   another part three

Usage: to align the whole buffer, type :Tabbi, for aligning parts type e.g. :10,20Tabbi or use visual mode.



With the function Tabb(<pattern> [<trim> [,<separator]]) it is possible to format the selected lines.
<pattern> is the pattern after which the lines should be formatted, §x or §x-y is replaced by the corresponding column. §- can be used to align the lines like the :Tabbi command.
<trim> is a boolean specifying if the parts are trimmed (default 0).
<sep> is a string or regular expression that specifies the string separating the line into columns. The default is tabs or two or more whitespaces.
See the plugin file for more details.

Before:
part one, part two  ,part three , part four, rest
one  , two , three

-> select the lines and type :call Tabb("§2: §1§- - §3-4", 1, ",")

Result:
part two: part one  - part three , part four
two: one                  - three
 
install details
Put tabbi.vim in the plugin folder (e.g. ~/.vim/plugin/).
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tabbi.vim 1.2 2010-11-21 7.0 Daniel Schemala Whitespace at the beginning of the line are not pruned any more, and added a new formatting function.
tabbi.vim 1.1 2010-10-17 6.0 Daniel Schemala Works now also with two or more whitespaces as separator, and aligns with tabs or whitespaces according to the setting of “expandtab”.
tabbi.vim 1.0 2010-10-16 6.0 Daniel Schemala Initial upload
ip used for rating: 3.229.142.91

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
OSDN