Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Separate Vim spellfile for custom words

I just started using the spell checking feature in vim. According to the documentation, zg adds the current word to the first spellfile.

Is it recommended to create an own, empty spellfile, so that the English one doesn't get littered? If so: How do I create an empty spell list? An empty appropriately named file yields "E757: This does not look like a spell file".

like image 511
Tim Avatar asked Mar 13 '11 11:03

Tim


1 Answers

Using your own additional spell files is both the recommended and default way of doing custom spelling. In Vim you have a 'root' spell file based on the current language and encoding, and an optional quantity of 'additional' spell files.

The easiest way to create an additional spell file (if you haven't already) is simply to add or remove a word using zg or zw - If 'spellfile' is empty, an new additional spell file will be created in the first writeable directory in 'runtimepath'.

The naming of spell files can be a bit tricky. Firstly, Vim takes a text file containing a list of words and converts it into a binary file which is a lot quicker to work with internally. The reason you're getting an error E757 is that Vim is attempting to load the binary spell file, but it's not finding the marker text at the start of the file, so it's bailing out.
To create your own spell files the filename needs to be in the format "mySpellFile.en.utf-8.add" where spelllang=en and encoding=utf-8.

like image 102
PDug Avatar answered Nov 13 '22 18:11

PDug