Spell Checking
For most file types, spell checking is disabled by default. To enable it for your current file use setlocal or set to enable it for all open files:
:setlocal spell
Once activated misspelled words will be highlighted:
The language used by default is English (en), but can be changed with:
:set spelllang=xx
Where xx is the two letter code of the language to use (eg. es for Spanish, nl for Dutch and so on). You can also use multiple dictionaries simultaneously or specify a regional variant of the form xx_xx:
:set spelllang=en_CA,es
If you want to set spelllang permanently, you just have to include the command in your vemrc file.
Jumping to and fixing misspelled words
The following keys allow you to visit all the spelling mistakes in your document:
- Space y:
move to previous misspelled word before the cursor
- Space n:
move to next misspelled word after the cursor
- Space z:
move to previous misspelled word before the cursor
- Space n:
move to next misspelled word after the cursor
- Space y:
move to previous misspelled word before the cursor
- Space n:
move to next misspelled word after the cursor
You can get a list of suggested words to replace the misspelled word with:
- Space ?:
suggest correctly spelled words to replace the misspelled one under the cursor.
To use one of the suggested words just enter its number and press Enter.
Custom dictionary
You can have your own lists of words that should be considered valid when the spelling of your files is checked.
Use the following commands to manage these lists:
- <Space> +:
add the word under cursor to your list of valid words
- <Space> -:
remove the word under cursor from your list of valid words