Tabular

Common usage

Tables

1
:Tab /|
1
2
3
4
5
| Fruit  | Color  |
| ----- | ----- |
| Apple | Red |
| Banana | Yellow |
| Kiwi | Green |

Variables

1
:Tab /=
1
2
3
title = "Hello"
src = "image.jpg"
width = 640

Colons

1
:Tab /:\zs/l0l1
1
2
3
4
5
title:       "Hello world"
description: "This is a description"
src: "image.jpg"
height: 320
width: 640

Tab command

Basic example

1
:Tab /:
1
2
title : My picture
src : img.jpg

Right align

1
:Tab /:/r0
1
2
title:My picture
src: img.jpg

The \zs atom

1
:Tab /:\zs
1
2
title:  My picture
src: img.jpg

The \zs atom will exclude the : from the search match.

Specifier

1
:Tab /:/r1c1l0
1
2
title : My picture
src : img.jpg

Explanation

  • r1 – Right align with 1 space
  • c1 – Center align the comma with 1 space
  • l0 – Left align with 0 spaces

Regexp

1
:Tab /^[^,]*\zs,/r0
1
2
3
abc,hello
c,hi there
a,yo

Specifiers

Specifier Description
r1c1l0 multiple specifiers, one per column
(the separator counts as a column)
— —
lN Left-align (with N spaces padding)
rN Right-align (with N spaces padding)
cN Center-align (with N spaces padding)

Also see