tabular: update
This commit is contained in:
parent
a418f067bd
commit
83e778382c
84
tabular.md
84
tabular.md
|
@ -1,37 +1,81 @@
|
||||||
---
|
---
|
||||||
title: Tabular
|
title: Tabular
|
||||||
category: Vim
|
category: Vim
|
||||||
|
layout: 2017/sheet
|
||||||
|
updated: 2017-10-11
|
||||||
|
weight: -1
|
||||||
|
intro: |
|
||||||
|
[Tabular](https://github.com/godlygeek/tabular) is a Vim script for text alignment.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Examples
|
## Examples
|
||||||
|
{: .-three-column}
|
||||||
|
|
||||||
`:Tab /,`
|
### Basic example
|
||||||
|
|
||||||
hello , there
|
```
|
||||||
hi , you
|
:Tab /,
|
||||||
|
```
|
||||||
|
{: .-setup}
|
||||||
|
|
||||||
`:Tab /,/r0`
|
```bash
|
||||||
|
hello , there
|
||||||
|
hi , you
|
||||||
|
```
|
||||||
|
|
||||||
hello,there
|
### Right align
|
||||||
hi, you
|
|
||||||
|
|
||||||
`:Tab /,/r1c1l0`
|
```
|
||||||
|
:Tab /,/r0
|
||||||
|
```
|
||||||
|
{: .-setup}
|
||||||
|
|
||||||
# the separator counts as a column
|
```bash
|
||||||
# [r]ight align, [1] space, [c]enter align the comma, [1] space,
|
hello,there
|
||||||
# [l]eft align, [0] spaces
|
hi, you
|
||||||
hello , etc
|
```
|
||||||
hi , etc
|
|
||||||
|
|
||||||
`:Tab /^[^,]*\zs,/r0`
|
### Specifier
|
||||||
|
|
||||||
abc,hello
|
```
|
||||||
c,hi there
|
:Tab /,/r1c1l0
|
||||||
a,yo
|
```
|
||||||
|
{: .-setup}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hello , etc
|
||||||
|
hi , etc
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Explanation
|
||||||
|
|
||||||
|
- `r1` -- Right align with 1 space
|
||||||
|
- `c1` -- Center align the comma with 1 space
|
||||||
|
- `l0` -- Left align with 0 spaces
|
||||||
|
|
||||||
|
### Regexp
|
||||||
|
|
||||||
|
```
|
||||||
|
:Tab /^[^,]*\zs,/r0
|
||||||
|
```
|
||||||
|
{: .-setup}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
abc,hello
|
||||||
|
c,hi there
|
||||||
|
a,yo
|
||||||
|
```
|
||||||
|
|
||||||
### Specifiers
|
### Specifiers
|
||||||
|
|
||||||
l|r|cN # left-right-center, with N spaces padding (l0)
|
| Specifier | Description |
|
||||||
r1c1l0 # multiple specifiers (one per column)
|
| --- | --- |
|
||||||
# the separator counts as a column
|
| `r1c1l0` | multiple specifiers, one per column<br>(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
|
||||||
|
|
||||||
|
- [godlygeek/tabular](https://github.com/godlygeek/tabular) _(github.com)_
|
||||||
|
|
Loading…
Reference in New Issue