Pages

Thursday, February 26, 2009

Vim and Spell Check

I often need to check my spelling when marking up websites or coding for website output. Thankfully, my text editor of choice has a nifty spell check feature. The key is

:set spell

You can add this to your vimrc or just type it in command mode. And I guess if you wanted to be really fancy, you could enable spell-check per file type, but I went the vimrc route. Also, when using gvim, you can enable or disable spell check from the Tools > Spelling Menu. This menu also gives some hints for using the spell checker.

After enabling spell check, you'll notice blue and red underlines under certain words; blue is apparently for grammar syntax (such as failing to capitalize a word) and red is for spelling errors.

  • ]s and [s goes to next or previous error respectively.
  • When the cursor is over a word, use z= for suggestions.
  • :spellrepall repeats a correction.

As usual, there are lots more features to explore. Check out vim help or go to the vimdoc site:

http://vimdoc.sourceforge.net/htmldoc/spell.html