Line Motions

0 / ^ / $ โ€” the three places that matter on a line.

Keys: 0, ^, $

0 jumps to column 0. ^ jumps to the first non-blank character. $ jumps to the end of the line. They're motions, so d$ deletes to end of line, c0 changes to start.

A line has three interesting positions: the actual start (column 0), the first non-blank character (where the code begins), and the end. Vim gives them three keys.

Jump to column 0
KeyNote
0
Jump to first non-blank
KeyNote
^
Jump to end of line
KeyNote
$
0 โ€” column 0
^ โ€” first non-blank
$ โ€” end of line

Reference

Key Lands on Type
0 Column 0 (the actual start) Exclusive
^ First non-blank character Exclusive
$ End of line Inclusive
g_ Last non-blank character Inclusive

Worked example โ€” 0 ^ $

Three flavors of line start/end.

Step 1 ยท
editing.line-motions
Step 2 ยท 0 ยท 0 โ€” column 0 (literal start).
0 โ€” column 0 (literal start).
Step 3 ยท ^ ยท ^ โ€” first non-blank.
^ โ€” first non-blank.
Step 4 ยท $ ยท $ โ€” end of line.
$ โ€” end of line.

Use ^ when you want code, 0 when you want column zero, $ to land on the last char.

โ–ถ Try this in the simulator

See also: Delete, Change, More Ways into Insert