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 ends insertion; u undoes an edit. 0 reaches the line start; 2G reaches line 2. A count repeats a movement, so 3l moves three characters right.

More about this lesson

Keep the quotation marks. Change what they contain.

Prerequisite: changing and deleting a word. i" selects the contents of the double-quoted pair containing your cursor; spaces and punctuation inside the pair belong to it. Start inside the intended quotation, especially when the line contains several pairs.

const state = "not ready";

From inside “not ready”, ci", then ready now, then Esc replaces the complete message. di" empties it. Both preserve the quotes. a" includes the quotation marks too; that is a different edit.

These exercises use ordinary double-quoted text on one line. Escaped quotes, multiline strings and nested bracket objects need their own later lessons.

Guides on this topic

Exercise 1 of 3

0keys

par 18

Set the message to “Read the final”. Keep its quotes and the surrounding text.

Your textVim mode: Normal

Desired result

const reminder = "Keep this line unchanged.";
const message = "Read the final";

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.