← All lessons

3. Basic Navigation

Step 3 of 6

Navigating within the current line

We’re not just interested in jumping to specific lines; we also want to navigate within that line.

We could just use h and l (or the arrow keys) to move left and right one character at a time, but there are better ways. In fact, Vim gives us a few tools for navigating horizontally in the line.

The two simplest are ^ and $ in normal mode, which jump the cursor to the start and the end of the line respectively. There is also I and A, which do the same thing as ^ and $, but they automatically drop you into insert mode. That’s useful if you want to quickly insert some new text at the start or end of the line.

If you want to specify a more precise position somewhere on the line, the f and F commands in normal mode are your friends!

You can also use the ; command in normal mode to repeat the last f or F motion — so if you use f but find that you’re still not in the place you want, keep hitting ;.

Have a play with these commands in the editor.

Loading editor…