Keep the quotation

0 of 3

The technique

Your textVim mode: Normal
Replace the message and keep its quotes. Before: const state = "not ready";. After: const state = "ready now";.

Spaces inside the quotes belong to the text, so the whole message changes.

Keys in this lesson

ci"
Change the text inside double quotes.
di"
Empty the quotes.
Before you begin

Use h, j, k, l to move in Normal mode. Esc stops inserting and u undoes an edit. 0 goes to the start of the line and 2G goes to line 2. A count repeats a movement, so 3l moves three characters right.

More about this lesson

Change what's inside the quotation marks and keep the marks themselves.

You'll need the lesson on changing and deleting a word first. i" means everything inside the double quotes, including spaces and punctuation.

const state = "not ready";

From inside “not ready”, ci", then ready now, then Esc replaces the whole message. di" empties it. Both keep the quotes. a" takes the quotation marks too, which is a different edit.

From before the first string on a line, ci" finds that string ahead of your cursor. When a line has two strings, move inside the one you mean first.

These exercises use plain double-quoted text on one line. Escaped quotes, strings over several lines and nested brackets aren't covered here.

Guides on this topic

Exercise 1 of 3

0keys

par 15

The page has no heading yet. Make it Your orders.

Your textVim mode: Normal

Make it look like this

import { OrderList } from "./OrderList.jsx";
import { PageHeader } from "./PageHeader.jsx";

export function OrdersPage({ orders }) {
  return (
    <main>
      <PageHeader title="Your orders" />
      <OrderList orders={orders} />
    </main>
  );
}

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.