vimspelling

How to correctly set the spellfile in VIM?


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.


Solution

  • 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.)