3

I want to use the spelling rule: begin first word in a sentence with capital letter, but Vim faultily recognises the end of a sentence when I use shortcuts that end with a dot.

The problem exists only with my native language. When using en_gb this sentence is correct:

He likes many pets, e.g. cats.

But the Polish version is not correct (when using pl as the spelling language):

On lubi różne zwierzęta, np. koty.

The word koty is marked with the capital letter error. Vim thinks that the dot that belongs to the shortcut np. marks the end of sentence.

I tried to modify the spellcapcheck setting by adding the negative look behind to the regex:

:set spellcapcheck=(?<!np)[.?!]\_[\])'" \t]\+

This modification broke the rule entirely (Vim stopped showing capital letter error everywhere). Maybe my regex is not correct. But I also think I look at the wrong place to configure it, as the spellcapcheck setting is not modified when the I set en_gb on:

:set spellcapcheck?
spellcapcheck=[.?!]\_[\])'"^I ]\+
2

I found the solution. You need to add the shortcut to the dictionary, including the dot. So I expect that in case of en_gb the word e.g. is included in the default dictionary.

The problem is, you cannot use zg to add the shortcut to the dictionary, because in this case only np will be added, not np.. You need to add the line:

np.

in the $HOME/.vim/spell/pl.utf-8.add file manually.

Please mind that the change will not take affect until the binary file $HOME/.vim/spell/pl.utf-8.add.spl is recompiled. You can trigger its recompilation by adding another word to the dictionary, this time from Vim, using zg (I don't know another way to do this). It does not have to be a word unknown to the default dictionary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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