Step 4 of 6

Using a count to repeat motions

Using a count to repeat motions

All the things we’ve learned in the past few sections can be described as ‘motions’. A motion is any command that moves the cursor.

Most motions can be supplied with a count, which tells Helix how many times to repeat the movement. For example, the j command (for moving the cursor downwards) accepts a count that tells it how many lines to move. If you type 10j, Helix will move the cursor ten lines down.

Counts work with the character jumps from the last step too: 2fX jumps to the second X on the right, in a single stride.

Work through the checklist below — each motion is one count-powered stride.

  1. Drop five lines in one motion From the top line (gg takes you back), the line of Xs is five below — type 5j.
  2. Jump to the second X in one go Type gh to sit at the start of the X line, then type 2fX.
  3. Climb three lines in one stride Three presses of k in a single motion — type 3k.
Drop five lines in one motion From the top line (gg takes you back), the line of Xs is five below — type 5j.

Next: Jump to the second X in one go

Loading editor…