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
1const unnecessaryVariable = null;2const 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!
- Navigate to each green target across the code snippet.
- Use the motions and techniques learned in this lesson to land accurately on each target.
- See how fast you can complete 10 targets.
0/10
1const unnecessaryVariable = null;2const activeUser = getActiveUser();NORMAL
00:00
NextCtrl+jDelete Words