user882355
user882355

Reputation: 31

Adding a wordlist to vim spell

I have a really long list of (chemistry) words that I want to add to the vim spell checking file. To do this it looks like the best way is to get the english dictionary (I used the .oxt from libreoffice for the en_US.dic and en_US.aff files) and then do (in the directory with these three files):

:mkspell ./chemdic chemistry.dic en_US

but no matter how I try it seems I always get an error about an invalid region in a file. Sometimes it is in the first argument, sometimes in the second and if I use the --ascii option it gives the E755 in regards to the output file (which makes no sense to me).

Please help?

Upvotes: 3

Views: 3853

Answers (2)

Jakub Klinkovský
Jakub Klinkovský

Reputation: 1362

I've run across the same issue when generating a dictionary from cs_CZ hunspell dictionaries. I've managed to solve it with the following:

# go to directory with cs_CZ.aff and cs_CZ.dic files
cd /usr/share/hunspell
# convert into cs.spl
env LANG=cs_CZ.utf-8 vim -u NONE -e -c "mkspell! $HOME/.vim/spell/cs cs_CZ" -c q

I think this can be adjusted for custom wordlists, but I did not try it...

Upvotes: 2

unxnut
unxnut

Reputation: 8839

You can create a local spell file that has all the words you need, one per line. Let us call this file lspell. Then, you can refer to this file as your local repository of spellings. For example, if you are checking spellings in the file myfile, you can issue the command: spell +lspell myfile and it should work.

Upvotes: 1

Related Questions