

Vim Easyalign cheatsheet
source link: https://devhints.io/vim-easyalign
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Command mode
Align by delimiters
:EasyAlign : " preset characters (\=:.,|)
:EasyAlign |
:EasyAlign \ " \ means space
Align by regexp
:EasyAlign /[:;]+/
Specify which
:EasyAlign | " align by 1st `|`
:EasyAlign 3 | " align by 3rd `|`
:EasyAlign * | " align by all `|`s
Add options
:EasyAlign * | l4r1
l4 " lN - left_margin
r1 " rN - right_margin
" spaces to the left/right of `|`
ar " a[lrc] - align
" align left/right/center
dr " d[lrc] - delimiter_align
" alignment of the delimiter itself
Spaces are optional
: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)
| `<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
Recommend
-
147
Create A Built-in Vim Cheatsheet
-
113
Basic Kotlin cheatsheet / read-only ...
-
149
Exiting :qa Close all files :qa! Close all files, abandon changes :w ...
-
95
vim cheatsheet Add to FavoritesSharevim cheatsheet
-
9
Vim 中文速查表/Cheatsheet(全网最完善) 春节期间整理了一份 Vim 中文速查表,免得经常东搜索西搜索的: https://github.com/sky...
-
5
Usage :Unite file :Unite file_rec/async:! :Unite tag :Unite buffer Sources file/new file/async file_rec/async
-
7
Typing digraphs in insert mode <Ctrl-K>OK Listing digraphs :dig :digraphs Reference Symbols ℠ ™ © ® ¶ † ‡ – ± SM TM Co Rg PI /- /= – +- § µ £ ¢ ¥ ¤ SE My...
-
4
Vim helpfiles cheatsheet Creating a document :e doc/potion.txt :set ft=help :set ft=text Use ft=help to preview it, and ft=text to edit it.
-
27
VIM-GO Plugin https://github.com/fatih/vim-go Tutorial https://github.com/fatih/vim-go-tutorial Vimrc https://github.com/fatih/dotfiles/blob/master/vimrc Commands F...
-
8
Save This Vim CheatsheetFebruary 6th 2023 New Story6 min by
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK