Find a character boundary

0 of 4

The technique

Your textVim mode: Normal
Move to just before the first comma. Before: red, blue, green. After: red, blue, green.

t stops just before the character. f, would land on the comma itself.

Keys in this lesson

f,
Jump to the next comma on the line. Any character works.
t,
Jump to just before it.
F,
Jump back to the previous comma.
T,
Jump back to just after it.
;
Repeat the last f, t, F or T.
,
Repeat it the other way.

Before this lesson: Compose an edit and the word and quotation lessons.

More about this lesson

Know whether a character search lands on the character or next to it.

f finds a character to the right on the current line and t stops just before it. F searches to the left and T stops just after the character it finds. ; repeats the search and a comma repeats it in the other direction. None of them leave the current line. A count picks a later match, as in 2f,.

Example

On “red, blue, green”, f, from r lands on the first comma and t, lands on d. From g, F, lands on the comma before green and T, lands on the space after it. dt, from r deletes up to the comma and keeps the comma itself.

Use Start over to try again.

Guides on this topic

Exercise 1 of 4

0keys

par 2

Put the cursor on the ( after formatPrice.

Your textVim mode: Normal

Move the cursor here

4    const label = order.total > 0 ? formatPrice(order.total, order.currency) : "Free";

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
Start the exercise over
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Ctrl+Alt+K⌃⌥K
Show the keyboard shortcuts
Ctrl+Alt+F⌃⌥F
Turn focus mode on or off
Ctrl+Alt+S⌃⌥S
Open the editor settings
Enter
Go on to the next step after you finish

The Ctrl+Alt shortcuts don't clash with Vim's own keys. On a Mac, use Control and Option.