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. Helix gives us a few tools for
navigating horizontally in the line.
The two simplest live in the goto menu from the last step: gh jumps to the
start of the line and gl to the end. There are also I and A, which do
the same thing but 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 t commands in normal mode are your friends!
f, followed by a character, jumps the cursor forwards onto the next instance of that charactert, followed by a character, jumps forwards till that character — it stops one shortF, followed by a character, jumps backwards onto the previous instance of that characterTjumps backwards till that character, stopping one short
Notice that each jump highlights everything between where you were and where you landed: in Helix, every motion is also a selection. We’ll put that to work in the next lesson.
To repeat the last f or t jump, press Alt-. — so if you’re still not in
the place you want, keep hitting it.
Work through the checklist below — and have a play with F, T, I, and A
on your own while you’re there. The count trick in the next step is another
way to reach a later X.