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, indent or uppercase the intended region while retaining its neighbours.

J joins the next line and normally inserts a separating space. gU takes a motion or text object and uppercases that region. >> shifts a line right; a count can cover several lines. Indentation is formatting here, not proof that a program has the intended behaviour.

Example

In a note, J can turn “Read the” and “guide.” into “Read the guide.”. gUiw from guide changes only that word to GUIDE.

Use Reset to try again.

Guides on this topic

Exercise 1 of 3

0keys

par 2

Indent the first line by one two-space step. Preserve the other lines.

Your textVim mode: Normal

Desired result

  // Review dates
// Publish notice
// Keep the archive unchanged.

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
Reset the exercise
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Enter
After a solve: the next step

Ctrl+Alt shortcuts leave Vim's own keys alone. On a Mac, Control and Option.