Using Vim's built-in spellcheckerTue 27 March 2018
Recently, I have took some time to evaluate my workflow when using Vim and I
started to wonder if I really need to use the
aspell command for checking the
spelling of the article?
The answer is - of course not!
Vim - being the awesome editor it is - has a built-in spellchecker. I have just never reflected on the idea of using the editor itself for the task. I think that my error can be more widespread, so here is the quick guide for enabling the spellchecker.
First of all, I recommend looking at the documentation:
(First thing to note is that this is strictly a Vim feature - sorry, Vi users). But if you are lazy (or don't want to look at the docs) here is the basic modus operandi.
What to do
- Enable spell
- Set the language that the text is written in
And that's it - now using the command
[s you can jump between the
words with bad spelling. If you wish to get advice on the spelling - having
cursor on the word press
z= to get a list of possible spellings.
This isn't perfect, we can do better, of course. We can setup Vim to visually show us where the badly spelled words are - like this:
:highlight SpellBad cterm=underline ctermfg=red
And now the wrong words will be colored red and underlined. (Side note: when
using GVim you can set the
undercurl to achieve an effect similar
to most word processors).
I hope this was somewhat interesting and useful to read. There are more the this 'subsystem' in Vim - I strongly recommend digging through the documentation.