I'm trying to use spellchecker in vim; if I want to add a word to the internal dictionary (so that it is not highlighted as wrong) by the zg command, it says "option spellfile is not set"
.
I tried to type :set spellfile=PATH.../.vim.spell
,
but I always get "Invalid argument: spellfile=PATH.../.vim.spell"
. Any hint please?
I'm using linux Ubuntu 12.04.
vim Spell checker Spell CheckingTo turn on the vim spell checker run :set spell . To turn it off run :set nospell . If you always want the spell checker to be on, add set spell to your vimrc. You can turn spelling on only for certain filetypes using an auto command.
This spellfile by default is stored in the directory ~/. vim/spell and its filename is of the format lang.
To add words to your own word list: zg Add word under the cursor as a good word to the first name in 'spellfile'. A count may precede the command to indicate the entry in 'spellfile' to be used. A count of two uses the second entry. In Visual mode the selected characters are added as a word (including white space!).
You cannot choose an arbitrary name. :help 'spellfile'
says:
It must end in ".{encoding}.add".
So, use a syntax like this (and ensure that the spell
directory exists):
:set spellfile=~/.vim/spell/en.utf-8.add
For encoding, check :set encoding?
(Technically, it's the buffer-local 'fileencoding'
setting, but that most defaults to the former.)
Maybe you should just do mkdir ~/.vim
.
By default, the spell files are stored there. But if vim could not find that folder, it will complain with this error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With