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!
f, followed by a character, jumps the cursor forwards to the next instance of that characterF, followed by a character, jumps the cursor backwards to the previous instance of that character
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.