Mission 17 / 52• Basic Operators

Delete Multiple Lines

Operators compose with vertical motions too! `dj` deletes the current line plus the line below (2 lines total).

Prefixing `d` with numbers like `3dd` or combining with motions lets you wipe out entire code sections.

Multi-line deletion

  • djdelete current line and the line below (2 lines total)
  • dkdelete current line and the line above (2 lines total)
  • dGdelete from cursor all the way to the end of the file
  • dggdelete from cursor all the way to the start of the file
1
function legacyModule() {
2
const obsolete = true;
3
console.warn("Deprecated");
4
return null;
5
}

Position on `const obsolete` and press `dj`. Both the variable and the `console.warn` disappear together.

Now it's your turn!

  1. Navigate to each green target across the code snippet.
  2. Use the motions and techniques learned in this lesson to land accurately on each target.
  3. See how fast you can complete 10 targets.
0/10
1
function legacyModule() {
2
const obsolete = true;
3
console.warn("Deprecated");
4
return null;
5
}
NORMAL
00:00