Tabular is a Vim plugin for aligning text, tables, and code assignments.
Common Alignment Tasks
Markdown Tables
:Tab /|
Aligns markdown tables along pipe delimiters:
| Fruit | Color |
| Apple | Red |
| Banana | Yellow |
| Kiwi | Green |
Assignments
:Tab /=
title = "Hello"
src = "image.jpg"
width = 640
Key-Value Colons
:Tab /:\zs/l0l1
title: "Hello world"
description: "This is a description"
src: "image.jpg"
height: 320
width: 640
Formatting Commands and Specifiers
The \zs Anchor
The \zs regex atom sets the start of the match, excluding preceding characters from alignment spacing:
:Tab /:\zs
Field Specifiers
Specifiers define alignment per column (l for left, r for right, c for center) followed by padding spaces:
| Specifier | Meaning |
|---|---|
lN |
Left-aligned column with N spaces padding |
rN |
Right-aligned column with N spaces padding |
cN |
Center-aligned column with N spaces padding |
r1c1l0 |
Multi-column sequence: 1st column right, delimiter centered, remainder left |
Regexp Alignment
Align by comma while ignoring commas in quotes:
:Tab /^[^,]*\zs,/r0