Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to do:

:spellgood w/o

I get an error message saying

Unrecognized flags in ~/.vim/spell/en.utf-8.add line 16

I have attempted the following to no avail:

:spellgood w\/o
:spellgood w//o
:spellgood "w/o"
:spellgood 'w/o'

I also tried visually selecting the word in question and hitting zg. Same error.

How can I get vim to stop telling me that w/o is a bad word?

Adding o to the spell file or capitalizing w/o to W/O works, but those options make me sad.

Update

I have added the following as ~/.vim/spell/en_US.aff

SET ISO8859-1
KEY qwertyuiop|asdfghjkl|zxcvbnm
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'-
NOSUGGEST !

# ordinal numbers (1st, 2nd, 3th, 11th) and decads (0s, 10s, 1990s)
COMPOUNDMIN 1
# only in compounds: 1th, 2th, 3th
ONLYINCOMPOUND c
# compound rules:
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
COMPOUNDRULE 2
COMPOUNDRULE n*1t
COMPOUNDRULE n*mp
WORDCHARS 0123456789' 

and the following file as ~/.vim/spell/en_US.dic

1
w\/o

and have executed the following vim commands:

:cd ~/.vim/spell
:mkspell mine en_US.aff
:set spelllang+=mine
:spellinfo
file: ~/.vim/spell/en.utf-8.spl
file: ~/.vim/spell/mine.utf-8.spl
file: ~/.vim/spell/en.utf-8.add.spl

And I still cannot get vim to recognize w/o as a good word.

share|improve this question
    
The reason the adding o to the file works is because you already added w to the spell file. –  FDinoff Jul 23 '13 at 21:10
    
@FDinoff I understand that, but what I was attempting to say is that adding w and o separately is an unacceptable solution. –  kzh Jul 25 '13 at 18:15
    
I agree adding both would be weird. –  FDinoff Jul 25 '13 at 18:16
add comment

2 Answers

From :help spell

Note: in line 5 to 7 non-word characters are used. You can include any character in a word. When checking the text a word still only matches when it appears with a non-word character before and after it. For Myspell a word starting with a non-word character probably won't work.

In line 12 the word "TCP/IP" is defined. Since the slash has a special meaning the comma is used instead. This is defined with the SLASH item in the affix file, see |spell-SLASH|. Note that without this SLASH item the word will be "TCP,IP".

Above it defines some custom words, TCP/IP being one of them. So you should just need to use , instead of / in this case.

i.e. use w,o

Edit

As you point out, I was pointing toward documentation about .dic files, which in my limited experience are more common. In the .dic file, you can use your solution of w\/o (see :help spell-SLASH)

WORDS WITH A SLASH                                      *spell-SLASH*

The slash is used in the .dic file to separate the basic word from the
affix letters and other flags.  Unfortunately, this means you cannot
use a slash in a word.  Thus "TCP/IP" is not a word but "TCP with the
flags "IP".  To include a slash in the word put a backslash before it:
"TCP\/IP".  In the rare case you want to use a backslash inside a word
you need to use two backslashes. Any other use of the backslash is
reserved for future expansion.
share|improve this answer
    
So what you're telling me is that I should've RTFM better. –  kzh Jul 24 '13 at 12:49
    
This is not working for me. I enter the command :spellgood w,o and both the w and the o are highlighted red. Now i :help spell-SLASH, it says "the slash is used in the .dic file". I am not using a .dic file. :spellgood adds the word to my ~/.vim/spell/en.utf-8.add file. Are they the same filetype? Did you try your suggestion and see if it works? –  kzh Jul 24 '13 at 13:01
    
So it appears that there are two different file types: spell-wordlist, and spell-dic. I was attempting to use wordlist, your answer uses dic. I have no idea how to use dic, but am reasearching. –  kzh Jul 24 '13 at 13:13
    
I have been combing over the manual, but cannot find how to create a .dic file. I see several references, but do not see any instructions such as where it goes. Where do you have your *.dic? –  kzh Jul 24 '13 at 19:03
    
I updated my question, your answer still appears to be a no-go. –  kzh Jul 29 '13 at 22:11
add comment

You are nearly done, you are just doing a small mistake.

You have to compile the dictionary first, before moving it to ~/.vim/spell, the correct format is .spl instead of .aff.

I found a really good article about how you should install/create a spell file. I am using the wordlist that the author of the article was pointing to, however the wiki pages and links got messed up, so the link to it is below.

Here you can find the en_US dictionary/wordlist.
http://downloads.sourceforge.net/wordlist/hunspell-en_US-7.1-0.zip

EDIT
I didn't see your edit at first, so discard the information above - but if you use the wordlist provided it works. :)

share|improve this answer
    
Have you tried it with the word 'w/o'? Did it work? I will try replacing :mkspell mine en_US.aff with :mkspell mine en_US when I get home. Thanks. –  kzh Jul 29 '13 at 23:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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