Step 4 of 5

Incrementing and decrementing

Incrementing and decrementing

Helix can do arithmetic on the number under your cursor:

  • Ctrl-a adds one
  • Ctrl-x subtracts one

Both take a count, so 10 followed by Ctrl-a adds ten. They understand negative numbers and will happily carry across digits, so 9 becomes 10 and, with -1 selected, it becomes 0.

One thing to watch: these keys act on the selected text. A bare cursor selects one character, so on a single-digit number that’s fine, but on 8080 it changes only the digit under the cursor. Select the whole number first — e from its first digit does it — and the arithmetic applies to all of it.

Work through the checklist below to fix the numbering, then bump the port.

  1. Renumber 2) Next point with Ctrl-a Move down to line 3 — the cursor sits on the 2 — and press Ctrl-a.
  2. Renumber 3) Another point with Ctrl-a Move down a line and press Ctrl-a again.
  3. Renumber 6) Last point with Ctrl-x Move down a line and press Ctrl-x — the number goes down instead.
  4. Select 8080 with e, then press Ctrl-a Move down to the last line, press e to select the whole number, then Ctrl-a.
  5. Add ten more with 10 then Ctrl-a The number is still selected — type 10, then press Ctrl-a.
Renumber 2) Next point with Ctrl-a Move down to line 3 — the cursor sits on the 2 — and press Ctrl-a.

Next: Renumber 3) Another point with Ctrl-a

Loading editor…