Keep the quotation
The technique
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.