25

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.

PravinS
  • 2,640
  • 3
  • 21
  • 25
Peter Franek
  • 577
  • 3
  • 8
  • 25

3 Answers3

20

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

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
10

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.

Jagd
  • 181
  • 1
  • 4
0

I had the same problem. It was caused by surrounding the path with single quotes in my rc file. Remove the single quotes.

StevieD
  • 6,925
  • 2
  • 25
  • 45