Mission 08 / 52• Insert Like a Pro

Making Small Edits

Not every edit requires a prolonged trip into insert mode. Quick surgical fixes are vim's bread and butter.

With `s`, `x`, and `r`, you can fix single-character errors without losing your normal mode flow.

Quick edit commands

  • xdelete the character under the cursor
  • r{char}replace character under cursor with {char} without leaving normal mode
  • ssubstitute: delete char under cursor and enter insert mode
1
conzt title = "Vim Actual Hero";
2
let counter = 10000;
3
const isReady = falze;

Look at `conzt`: move cursor onto the `z` and press `r` followed by `s`. The typo is replaced immediately, and you remain in normal mode!

Try `x` to delete the extra zero in `10000`, or `s` on `falze`'s `z` to substitute it with `s`.

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
conzt title = "Vim Actual Hero";
2
let counter = 10000;
3
const isReady = falze;
NORMAL
00:00
NextCtrl+jMoving by WORDs