Command mode
Align by delimiters
1 2 3
| :EasyAlign : :EasyAlign | :EasyAlign \
|
Align by regexp
Specify which
1 2 3
| :EasyAlign | :EasyAlign 3 | :EasyAlign * |
|
Add options
1 2 3 4 5 6 7 8 9
| :EasyAlign * | l4r1
l4 r1 ar dr
|
Spaces are optional
1 2
| :EasyAlign * /[;:]+/ l3 :EasyAlign*/[;:]+/l3
|
Examples
:EasyAlign = dr (delimiter_align right)
apple = 1
banana += apple
cake ||= banana
:EasyAlign : (for json or yaml)
url: jdbc:mysql://localhost/test
database: test
:EasyAlign *| (markdown tables)
1 2 3
| | `<Enter>` | right align | | `1` | on 1st occurrence | | `2` | on 2nd occurrence (and so on) |
|
Interactive mode
| {Visual} ⏎ | activate for selection |
| ga {motion} | activate for motion/text object |
Then press options (if available), then a delimiter.
Interactive mode options
| ⏎ | Set alignment |
| <ctrl-l> 4 ⏎ | Set left_margin (to the left of the delimiter) |
| <ctrl-r> 4 ⏎ | Set right_margin |
| ↓ | no margin |
Example
gaip <ctrl-l> 8⏎ = - puts 8 spaces before the equal sign
Also see