Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've recently moved from using TextMate to using Vim a lot more (because I split my time between Mac and Linux). One thing I miss is the wonderful MultiMarkdown bundle which, amongst other features, lets me enter tables in MultiMarkdown syntax and then reformats them so they look pretty.

So, for example this:

| Heading 1 | Heading 2 | Heading 3 |
| --: | -- | -- |
| 1 | Some text | Some other text |
| 2 | A somewhat longer piece of text | Further text |

Becomes this:

| Heading 1 | Heading 2                       | Heading 3       |
| --------: | ------------------------------- | --------------- |
|         1 | Some text                       | Some other text |
|         2 | A somewhat longer piece of text | Further text    |

The closest thing I've found to this is table_format.vim, but it's pretty old and uses spaces instead of vertical bars to delimit columns.

Is there anything better out there to reformat tables like these in Vim?

share|improve this question
up vote 10 down vote accepted

The Align plugin can table-format by vertical bars using the shortcut "\t|".

share|improve this answer
    
That's great, thanks. It looks like that plugin will be handy formatting LaTeX documents too. – Jez Jun 8 '11 at 13:02
    
You are welcome. I use Align all the time. I just love table formatting. – Don Reba Jun 8 '11 at 15:39

I've also now come across Tabular.vim which is another plugin along the same lines as Align.vim. They're similar but each have advantages and disadvantages in how they work.

share|improve this answer
    
It's an old question BUT Vimcasts has an excellent podcast on using tabular.vim here: vimcasts.org/episodes/aligning-text-with-tabular-vim – Screenack Jan 3 '15 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .