Chapter 13. Other Cool Stuff in Vim

Chapters 8 through 12 covered powerful Vim features and techniques we think you should know to make effective use of the editor. From real-time spellchecking (with suggested corrections) to editing binary files and managing the state of your Vim session, this chapter takes a lighter look at Vim. It’s a catchall for some of the features that didn’t fit into previous topics, ideas about editing and the Vim philosophy, and some fun things about Vim (not that the earlier chapters weren’t fun!).

Spell It! (i-t)

Vim’s spellchecking excels in speed and flexibility. Per Vim’s ownspellchecker built-in help, Vim recommends replacing the vimspell plug-in with Vim’s built-in spellchecking features. See the help file spell.txt, or find help with the ex command:

:help spell

Vim defaults to no spellchecking. Turn spellchecking on with the ex command:

:setlocal spell

and the spellchecking region:

:setlocal spelllang=en_us

Vim flags “bad” words (because one person’s misspelled word is another one’s “good” word, hence a distinction between “bad” and “good” rather than “correct” and “incorrect”), uncapitalized words starting sentences, “rare” words (don’t ask), and “local” (regional) words. See Figure 13-1 for an example of how Vim highlights “bad” and “cap” flagged words, and see Figure 13-2 for an example of highlighted words.

lvv8 1301
Figure 13-1. Vim spellchecking ...

Get Learning the vi and Vim Editors, 8th 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.