Optional: numeric changes

0 of 1

The technique

Your textVim mode: Normal
Add three to the count. Before: items: 7. After: items: 10.

Ctrl-a finds the first number at or after the cursor, so you do not have to move onto it first.

Keys in this lesson

Ctrl-a
Add one to the number at or after the cursor.
Ctrl-x
Subtract one.
3Ctrl-a
Add three.

Before this lesson: Counts and recovery.

More about this lesson

Increment or decrement a decimal number while protecting nearby values.

Ctrl-a increments the number at or after the cursor on the line; Ctrl-x decrements. A count changes the amount. These exercises use decimal integers; prefixed bases and complex numeric formats have their own rules. Check the chosen number before pressing the command.

Example

From 7, Ctrl-a gives 8. From the same 7, 3Ctrl-a gives 10. This is a numeric change, not three Insert-mode keystrokes.

Use Reset to try again.

Guides on this topic

Exercise 1 of 1

0keys

par 1

Change only the current decimal count to the desired value. Preserve the archived count.

Your textVim mode: Normal

Desired result

const current = 8;
const archive = 7;

Yours

Par

Keyboard shortcuts
Ctrl+Enter
Check the result
Ctrl+Alt+U
Undo the last change
Ctrl+Alt+H
Show the next hint
Ctrl+Alt+R
Reset the exercise
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Enter
After a solve: the next step

Ctrl+Alt shortcuts leave Vim's own keys alone. On a Mac, Control and Option.