next up previous contents
Next: Macros Up: The Woodnotes Guide to Previous: Dealing with DOS, Unix   Contents

Spell Checking

Vim took a big step forward with version 7, which introduced spell checking and thus made Vim a much more attractive system for writing long text works. To take advantage of the new functionality, begin by typing :set spell, which turns on the spell checker with the default language.

Once the spell checker is running, the keystrokes [s and ]s move the cursor from error to error. With the cursor positioned over a misspelled word, the keystroke zg declares that this word is `good' and should henceforth be ignored; zw identifies a good word as one that should've been identified as an error. Finally, z= will request a list of suggestions from the ispell program, which allows you to choose what you want.

For Vim to be able to add these words to a custom dictionary, you must define your ``spellfile,'' and Vim's useful approach to doing so is to permit you to define and use as many spellfiles as you'd like. As such, you can have one spelling list for acronyms you need for one type of file without `contaminating' another dictionary. For example, :set spellfile=.spellfile.sailing.add creates a custom wordlist where you can put all your arcane sailing acronyms, and then choose not to load that dictionary while working on your medical thesis.

This is useful but not perfect - I happen to think emacs has the advantage here - and consequently prefer to exit vim and use the ispell program to spell check text files already written; the advantage is no highlighted text distracts you. However, as an editing tool, in-program spell checking can be a useful and productive feature.


next up previous contents
Next: Macros Up: The Woodnotes Guide to Previous: Dealing with DOS, Unix   Contents
Randall Wood 2009-08-04