Skip to content

Vim — operations I forget

Macros

qa             start recording into register a
... commands ...
q              stop recording
@a             replay
10@a           replay 10 times

Visual block mode

Ctrl-v to enter, select region, then I to insert at start of every line, A to append at end. Escape to apply.

Substitute across files

:args **/*.py
:argdo %s/old_name/new_name/ge | update

Marks

ma sets mark a at the current position. 'a jumps to that line, `a jumps to the exact position. Uppercase marks (mA) are global across files.

Splits

:vs      vertical split
:sp      horizontal split
Ctrl-w h/j/k/l   navigate
Ctrl-w =  equalise