Biological/Medical Dictionary in Vim
Creating Medical and Chemical Dictionaries for Vim
So, it’s come to the point in my Ph.D where I need to spell check. The problem is that a large number of the technical words I use aren’t in the default dictionary now provided by vim.
Time to add some!
This is actually quite easy to do, originally I tried compiling dictionaries as vim .spl files but this proved less simple thanj I had hoped. In the end I found a simple way of doing this using vim’s .add files.
Note: This assumes you’re using some form of English dictionary as base. Vim uses language (ignoring location) when loading the files so replace “en” with your language’s abbreviation.
In the ~/.vim/spell/ folder, any words you add to your dictionary using the “
zg" command in vim get added to a file here called en.utf-8.add. I’ve simply added any extra words I wanted in my dictionary a .add file in this folder.
Firstly grab the medical dictionary for open office from here (chemical dictionary here) and extract the contents using your archive manager of choice. You specifically need the .aff and .dic files for vim to compile them into a dictionary.
Once you’ve got both of these it’s a simple command to combine them all into one new file:
mv en.utf-8.add en.utf-8.temp
cat ~/.vim/spell/en.utf-8.temp ~/path/en_US_OpenMedSpel.dic ~/path/ChemDictOOo.dic > ~/.vim/spell/en.utf-8.add
Lastly, you need to compile the en.utf-8.add file into the en.utf-8.add.spl file that vim will load. Load up vim and run…
Test you got this right by opening your en.utf-8.add file and turning spell on (:set spell). Hopefully none of the words should be glowing red!
Edit: Thanks to MarshaG63 for pointing out some errors I had.