Choose the whole pair

0 of 6

The technique

Your textVim mode: Normal
Replace the argument and keep the brackets. Before: save(draft);. After: save(ready);.

ca( would replace the brackets as well. Start inside the pair you mean.

Keys in this lesson

ci(
Change the text inside round brackets.
ca(
Change the brackets and what they hold.
ci[
Change inside square brackets.
ci{
Change inside curly brackets.
ci'
Change inside single quotes.

Before this lesson: Words and quotations.

More about this lesson

Change what's inside a pair of brackets or quotes, or the pair as well. Start inside the one you mean.

i keeps the pair around the text and a takes the pair too. So ci( changes the arguments and ca( replaces the brackets as well. A bracket pair can span several lines, and inside nested brackets you get the innermost pair. If you start before a call, Vim 9.1 and this editor use the next pair on the line, but older versions of Vim do nothing, so start inside the pair you mean. Quote objects stay inside the quotation you're in.

Example

From inside (draft), ci( then ready then Esc gives (ready). ca( then ready gives just ready, without the brackets.

Use Start over to try again.

Guides on this topic

Exercise 1 of 6

0keys

par 9

track takes one event object now. Pass it just the event built on the line above.

Your textVim mode: Normal

Make it look like this

import { track } from "./track";
import { addToCartEvent } from "./events";

// Sent when a product goes into the cart. The dashboard counts these per product.
export function trackAddToCart(product, quantity) {
  const event = addToCartEvent(product, quantity);
  track(event);
}

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.