Monday, March 7, 2011

Vim Usage: spell checking

Yesterday, I needed to type a document using Latex. This is better to use Latex for document works especially for those needed proper layout. Latex provide a good layout function comparing with MS Word. However, for me, I probably will make many typo error and in fact I typed lots of misspell word yesterday. Sometimes it is easy to find out but sometimes not. MS Word provides spell checking already. Fortunately, Vim 7 provides this function also. To enable it, use ":set spell" in command mode. To turn it off, type ":set nospell". If you are using Vim in terminal, you can see the misspell words are highlighted. You can use move key to go to the wrong words and fix them. In fact, you can use "]s" that is a useful function which moves the cursor to the next misspelled word. To move to previous misspell word, use "[s". When your cursor in over the wrong word, you can press "z=" to ask Vim to provide suggestions. I tried that and I found Vim spell checking are quite accurate, most likely the first one will fix my typo. If you want more information about spell checking function, use ":help spell" to read the documentation.

  • "]s" - move to the next mispelled word
  • "[s" - move to the previous mispelled word
  • "zg" - add a word to the dictionary
  • "zug" - undo the addition of a word to the dictionary
  • "z=" - view spelling suggestions for a mispelled word

No comments:

Post a Comment