Optional: markup objects

0 of 2

The technique

Your textVim mode: Normal
Change the emphasised word and keep its tags. Before: <p><em>draft</em></p>. After: <p><em>final</em></p>.

cit uses the innermost element around the cursor, here em. cat would replace <em>draft</em> as a whole.

Keys in this lesson

cit
Change inside an HTML element.
cat
Change the element, tags included.

Before this lesson: Paired objects.

More about this lesson

Change the text inside an HTML element, or replace the element and its tags.

In JavaScript the examples are JSX components, and in Python and plain text they're HTML templates. it is the text inside an element and at includes its opening and closing tags. You can start anywhere in the element, even on one of its tags. With nested elements, start inside the one you mean. This lesson is optional.

Example

From inside <em>draft</em>, cit then final then Esc keeps the em tags. cat replaces the whole element.

Use Start over to try again.

Guides on this topic

Exercise 1 of 2

0keys

par 36

You can follow a parcel in the app now. Make the paragraph under Delivery say Follow your parcel in the app.

Your textVim mode: Normal

Make it look like this

import { formatMoney } from "../lib/money";

export function DeliveryNote({ freeFromCents }) {
  return (
    <aside className="delivery-note">
      <h3>Delivery</h3>
      <p>Follow your parcel in the app.</p>
      <small>Free delivery from {formatMoney(freeFromCents)}</small>
    </aside>
  );
}

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.