0

I use the same configuration on Linux and Windows. This is the config for spelling:

" Set dictionary and regenerate spl files on startup
set dictionary+=/usr/share/dict/words
set spelllang=en_gb
if has('unix')
  set spellfile=$HOME/.config/vim/spell/en.utf-8.add
elseif has('win32')
  set spellfile=$HOME/vimfiles/spell/en.utf-8.add
endif
for d in glob('spell/*.add', 1, 1)
  if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
    exec 'mkspell! ' . fnameescape(d)
  endif
endfor

Everything works fine on Linux, and on Windows spellchecking works with :set spell even though there is no dictionary location explicitly set above. Where is that Windows dictionary coming from?

However, C-x, C-k spelling completion does not work on Windows. It works fine on Linux with a pulldown selection menu of words, but on Windows I get this error message instead:

-- Dictionary completion (^K^N^P) E486: Pattern not found

How do I fix this?

1 Answer 1

0

I realised just after posting this that it works after I comment out this line:

set dictionary+=/usr/share/dict/words

..so I'll set it like this:

" Set dictionary and regenerate spl files on startup
set spelllang=en_gb
if has('unix')
  set dictionary+=/usr/share/dict/words
  set spellfile=$HOME/.config/vim/spell/en.utf-8.add
elseif has('win32')
  set spellfile=$HOME/vimfiles/spell/en.utf-8.add
endif
for d in glob('spell/*.add', 1, 1)
  if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
    exec 'mkspell! ' . fnameescape(d)
  endif
endfor

There must be language dictionary files that come with vim on Windows or it uses a system dictionary.

2
  • 2
    /usr/share/dict/words is not provided by vim. It's provided by the OS (mainly Linux and BSD, but maybe MacOS does as well). :h dictionary tells you that if this option is empty, which is the default value, then vim uses the spell file associated with the value of :h spellang. If the associated file does not exist and if spellfile plugin is active, then vim downloads the required spell file through netrw. I gather this last scenario is applicable to your case.
    – 3N4N
    Oct 4, 2022 at 6:32
  • You can find all this ^ info from :h dictionary, :h spellang, and :h spellfile.vim.
    – 3N4N
    Oct 4, 2022 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.