vim.opperiesen.com opperiesen.com

Chapters

Esc to go back
your buffer

            
-- NORMAL -- 1:1
0 keystrokes · best possible: 0 — match it to earn the gold medal

Cheat sheet

Moving

h j k l
left, down, up, right
w b e
next word, previous word, end of word
W B E
same, ignoring punctuation
0 ^ $
column 0, first non-blank, end of line
gg G 5G
top, bottom, line 5
{ }
previous paragraph, next
%
matching bracket or brace
f x / t x
onto the next x / just before it
F x / T x
same, to the left
; ,
repeat the aim, repeat it backwards

Searching

/word ?word
search forward / backward
n N
next / previous match
*
search the word under the cursor

Editing

i a
insert before / after the cursor
I A
insert at start / end of line
o O
open a line below / above
x r s
delete, replace, substitute a character
d c y
delete, change, yank (+ motion)
dd cc yy
… on the whole line
D C
… to the end of the line
p P
paste after / before
u Ctrl-r
undo, redo
.
repeat the last change
J gJ ~
join lines (with / without a space), flip the case
Ctrl-a Ctrl-x
increment / decrement the number

Registers

"ayy "ap
yank into register a, paste it back
"0p
paste the last YANK, even after a delete
"1p
paste the last deletion
"_dd
delete into the black hole (keeps your yank)

Text objects

iw aw
the word / the word and its space
i" a"
the inside / everything, quotes included
i( i[ i{
the inside of the delimiters
ip ap
the paragraph

They combine with an operator: ciw, da(, yi"

Visual

v V Ctrl-v
character, line, block selection
o
jump to the other end
gv
bring back the last selection
> <
indent / unindent

Command line

:s/a/b/g
substitute on the line
:%s/a/b/g
… across the whole file
:g/x/d
delete every line containing x
:m$ :m0
move the line to the bottom / top
:t.
copy the line just below
q a … q
record a macro into a
@a 5@a
replay it, five times