Mission 13 / 52• Basic Operators

Intro to Operators

Vim is not just a collection of keybindings; it is a compositional language. An action is expressed as: `Operator + Motion`.

Operators dictate *what* to do (delete, change, copy). Motions dictate *where* or *how far* to do it.

Vim grammar

  • ddelete operator: removes text covered by the following motion
  • cchange operator: deletes text and enters insert mode
  • yyank operator: copies text covered by the motion into clipboard
1
const unnecessaryVariable = null;
2
const activeUser = getActiveUser();

Think of `d` as a verb and motions (`w`, `$`, `j`) as nouns. `dw` = delete word. `d$` = delete to line end.

Once you learn 4 operators and 10 motions, you know 40 combinations without memorizing 40 separate shortcuts!

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
const unnecessaryVariable = null;
2
const activeUser = getActiveUser();
NORMAL
00:00
NextCtrl+jDelete Words