The AlignTab plugin allows you to select a bunch of code and automatically align it on some arbitrary characters. Just choose AlignTab from the command palette (CMD + SHIFT + P) and you’re good to go.

Here’s an example of aligning on definition:

Align on Definition

And another on aligning on case matches:

Align on Pattern Match

Wouldn’t it be nice if you could preview the alignment before actually committing to it? Well you’re in luck with the Live Preview Mode you can do just that:

Align on Comma with Live Preview

Another nifty alignment is Table Mode. If you are writing a wiki-style table, this alignment automatically formats headings, columns and rows for you at application time and from then on. It also aligns any other tables you create on the page with the first table.

One caveate is that you need to escape the pipe symbol (|) (because it’s a regular expression) with a backslash before using it as a formatting character.

Align with Table Mode

You can also use complex regex matches for those highly customisable alignments. Dig into the documentation and examples to find out more.