Tip 123Fix Spelling Errors from Insert Mode

Vim’s spelling autocompletion allows us to fix typos without even having to leave Insert mode.

Picture this: we’ve just typed a line of text, and then we realize that there’s a spelling mistake a few words back. What can we do?

Preparation

This technique depends on having the spell checker enabled:

=> :set spell

The Usual Way: Switch to Normal Mode

To fix the mistake, we could switch to Normal mode, use the [s command to jump back to the spelling mistake, and then use 1z= to fix it. Having made the correction, we could then switch back to Insert mode with the A command, continuing where we left off.

The Fast Way: Use Spelling Autocompletion

Alternatively, we could fix the error from Insert ...

Get Practical Vim, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.