IN-Decent

Re-decentralizing internet with free software

Enable Auto Spell Check in VIM

Posted at — Jun 20, 2020

If you use VIM to write code or text documents then it is useful to know that VIM has an auto spell check feature and it will highlight word typos in red for the language while you type and also highlights any uncapitalised in blue. VIM is also smart enough to only spell check comments and string literals when it detects a code. Syntax highlighting must be enabled and available for programming language for it to work.

This feature is available only in VIM versions 7+ and can be enabled and disabled by using below commands respectively in command mode,

:set spell
:set nospell

To enable spell checking automatically, place set spell in your ~/.vimrc file.

By default spell checking is enabled for en, to enable spell checking for a different language or region specific English use,

:set spell spelllang=<language>
:set spell spelllang=en_us

To navigate to the highlighted words, get a list of possible suggestions and fix mistakes use below commands in escape mode,

For more details refer VIM documentation using,

:help spell - For info page about spell checking
:help z=    - For help about z= command.

References:

  1. VIM info pages - :help [name]
  2. RIP Tutorial - VIM - Spell Checking
  3. linuxhint.com - VIM Spell Check