Vim tips + tricks Want to support this page AND learn Vim? Check out https://xitter.cf/t.co/2oJQx5huwf OR https://xitter.cf/t.co/bcssgcdD4q Owned by @iggredible

Joined November 2019
If you have the jq command github.com/jqlang/jq installed, you can use it to format JSON in Vim! On the line where you have a large JSON object: { "foo": { "bar": { "foo_id": null, "bar_id": 98765, "baz_id": 12345 } } } Run: :.!jq . Vim bang operator/cmd: :h ! #vim
4
34
3,746
The vim-yoink plugin lets you to yank multiple times and quickly choose which yanked text to paste (with Ctrl-n/Ctrl-p). If you use copy/paste often, check it out! github.com/svermeulen/vim-yo… #vim
3
10
2,148
If you want to resize, swap, and move windows, the winresizer plugin (github.com/simeji/winresizer) can quickly resize your vim window with its resize mode. Check it out! #vim
5
20
3,811
If you have one large window and one small window, you can make them equal size with Ctrl-w + = :h CTRL-W_= #vim
10
2,028
You can "swap" windows with Ctrl-w + r (technically it's down/right-ward rotation, but works like a swap with only 2 windows) :h CTRL-W_r #vim
1
10
2,004
To roll a dice 5 times: :for i in range(1,5) | put='Dice roll: ' . (rand() % 6 + 1) | endfor #vim
2
2
20
2,706
If you want to close the current window, you can press Ctrl-w + c More: :h CTRL-W_c #vim
12
1,957
To generate 100 lines of "100 bottles of milk", you can run: :for i in range(100, 0, -1) | put = i . ' bottles of milk 🥛' | endfor #vim
3
12
2
155
13,438
To open the content of another file, use the :read command To read the content of foo.txt: :r foo.txt #vim
2
3
24
4,844
If you want to see Vim's search history, you can press q/ or q? If you recently did /foo, then you press q/, then you select foo, Vim automatically does /foo again for you. It saves you from typing the same past search! #vim
2
8
1
35
5,718