Reshape without retyping

0 of 3

The technique

Your textVim mode: Normal
Join the two lines, then make guide upper case. Before: Read the / guide.. After: Read the GUIDE..

J puts one space between the lines. gU works with any motion or text object.

Keys in this lesson

J
Join the next line to this one.
>>
Indent the line.
gUiw
Make the word upper case.

Before this lesson: Operators and counts.

More about this lesson

Join lines, indent them or make text upper case without touching the lines around them.

J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. >> moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.

Example

J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.

Use Start over to try again.

Guides on this topic

Exercise 1 of 3

0keys

par 1

This call fits on one line. Join the two lines.

Your textVim mode: Normal

Make it look like this

import { createOrder } from "../api/orders";

// Turns the cart into an order. The payment step comes after this.
export async function placeOrder(cart, customer) {
  const order = await createOrder(cart, customer);
  return order.id;
}

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.