back

The Vim pyramid

A visualization of motion commands of the Vim text editor in the shape of a pyramid. Vim's multitude of commands are kind of a language of its own, but memorizing at least some of them is a huge help for efficient text processing. The following Vim command pyramid can be printed on a single sheet of paper and serve as a memorization aid at your desk when learning Vim.

Vim motion commands

gg top
Ctrl+b previous screen1
[] end of previous C function
[* or [/ beginning of previous C comment
[[ beginning of C function
{ previous paragraph
( previous sentence
k previous line
0 beginning of line
^ first non-blank character
F{char} to previous {char} character
T{char} till previous {char} character
gE end of previous WORD2
B previous WORD2
ge end of previous word2
b previous word2
h previous character
l next character
e end of word2
w next word2
E end of WORD2
W next WORD2
t{char} till next {char} character
f{char} to next {char} character
g_ last non-blank character
$ end of line
j next line
) next sentence
} next paragraph
][ end of C function
]* or ]/ end of next C comment3
]] beginning of next C function
Ctrl+f next screen1
G bottom
1 Technically not a motion command, but also moves the cursor.
2 Assuming that cursor is at the middle of a word. Order differs if cursor is on first/last character.
3 Assuming multiline comments on top of each function.

Note that there are additional motion commands not shown in the pyramid, for example:

You can find more information about these commands in the motion.txt chapter of the official Vim manual. Run the :h motion.txt command in Vim to open the chapter.

Side-by-side comparison

A side-by-side comparison of the commands from the pyramid in tabular form:

Level Keys Backwards or upwards motion Keys Forwards or downwards motion
1 h previous character l next character
2 b previous word w next word
3 ge end of previous word e end of word
4 B previous WORD W next WORD
5 gE end of previous WORD E end of WORD
6 T{char} till previous {char} t{char} till next {char} character
7 F{char} to previous {char} f{char} to next {char} character
8 ^ first non-blank character g_ last non-blank character
9 0 beginning of line $ end of line
10 k previous line j next line
11 ( previous sentence ) next sentence
12 { previous paragraph } next paragraph
13 [[ beginning of C function ][ end of C function
14 [* abeginning of previous C comment ]* b end of next C comment
15 [] end of previous C function ]] beginning of next C function
16 Ctrl+b previous screen Ctrl+f next screen
17 gg top G bottom

a or [/

b or ]/


Copyright © 2021 by Thomas Heller [ˈtoːmas ˈhɛlɐ]