Spell checking in Vim
I recently came across an embarrassing typo on my own website. Buried deep in a paragraph of HTML inside a Rails HAML template, there was a glaring spelling mistake. I quickly raced back to Vim and opened the template and spell checked the whole file. How? With
Many novice Vim users are unaware that spell checking is built in and as easy as enabling with
:set spell. As a veteran Vim user, I was aware of spell checking and how to turn it on, but I frequently forget the full complement of commands. So for anyone that needs reminding, here are the basics for getting the most out of Vim’s spell checker:
:set spell– Turn on spell checking
:set nospell– Turn off spell checking
]s– Jump to the next misspelled word
[s– Jump to the previous misspelled word
z=– Bring up the suggested replacements
zg– Good word: Add the word under the cursor to the dictionary
zw– Woops! Undo and remove the word from the dictionary
In the screencast below, I’ve demonstrated a few of these. With the file open,
:set spell has already been enabled. I find the first misspelled word with
]s. It’s actually correctly spelled, it’s the name of my status page monitoring service, StatusGator. So I add the word to the dictionary with
zg. Then I find the next misspelling with
]s and press
z= to pull up the suggestion list. Finally, I press
2 to choose the replacement.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?