I have a list of words every is on its own line. This is the first column of a table. I'd like to create second column by hand.
I'd like to use some plugin now, that will create an ASCII table around the text, so I have nice formatting (the starting letters in each column should be in one "vertical line" or I should be able to quickly move to the correct position with one shortcut).
Is there such a plugin for vim that eases editing such tables and controls the formatting?
If you just want text alignment into table format, I use this and it works well:
http://www.vim.org/scripts/script.php?script_id=294
I wrote a command line tool a few years ago which does more closely what you want:
It allows you to edit a table in CSV format:
1,my table,another field
2,my table,yet another field
Then select the block in vim, and filter it using:
'<,'>!~/scripts/tab
This then gives you:
------------------------------------
| 1 | my table | another field |
| 2 | my table | yet another field |
------------------------------------
If you want to edit the table again, you can select the whole table and repeat with untab
(which is just a symlink -> tab) which converts the table back to CSV again so that you can edit.
There's also various other options:
-------------------------------------------------------------------------
| Command/Option | Purpose |
|----------------|------------------------------------------------------|
| tab | Reads from stdin and tabulates comma seperated input |
| tab <-t> | Tabulates input and assumes first row are titles |
| tab <-h> | Prints this help |
| tab <-nb> | Tabulates without a border |
| tab <-fw X> | Wrap fields greater than X big don't break words |
| tab <-fs X> | Wrap fields greater than X big and break words |
| tab <-vp X> | Vertically pad table by X lines |
| tab <-hp X> | Horizontally pad fields by X chars |
| tab <-b X> | Tabulates with a border made from char X |
|----------------|------------------------------------------------------|
| untab | Reads from stdin and untabulates table input |
| untab <-b X> | Untabulate a table with border char X |
| untab <-nb> | Untabulate a borderless table |
-------------------------------------------------------------------------