How to Spell Check in Neovim (nvim)
First, add the spell check in the init.vim file
" spell languages
set splelllang=en-gb
In the line above, we set the spell language to en-gb
(UK English).
See a list of language codes.
Enable set spell in your configuration file
I don’t want to use spell check all the time, I set a toggle for this option in normal and insert mode.
(To silently execute a map, use the <silent>
attribute for the map.)
nnoremap <silent> <F3> :set spell!<CR>
inoremap <silent> <F3> <C-O>:set spell!<CR>
Correcting spell errors in insert or normal mode
In insert mode, if you have typed some words which Vim thinks is miss-spelt, an underline is shown below the words. To correct the error, you can press <C-x>
followed s
. A completion menu will show a list of suggestions. You can then choose the correct one.
In normal mode, to navigate between the possible spell errors, use the following shortcut key:
[s
go to previous spell error]s
go to next spell error
If you think a word is not a spelling error, you can use zg
to add the word to your spell list. To correct an error, use z=
. A list of candidate words will be shown. You are prompted to enter a number to select the correct word.