Search code examples
vimspell-checking

How to force vim spellchecker to ignore lowercase/uppercase errors


I found here and here how to force Vim spell checker to ignore words with capital letters from being check. But my case is quite opposite. I want to ignore words that in corrected form include capital letters.

So in sentence:

europe was chozen best

only word chozen is the wrong one.

How to achieve that?

Thanks for any hint.


Solution

  • This answer was posted first by Rich on vi&vim stackexchange:

    I don't think that Vim has a setting for this. One workaround is to create a new spellfile that contains everything in your current spell file(s) but with lowercase letters only:

    1. Create a new buffer containing everything from the spell file(s) currently in use:

      :spelldump
      
    2. Delete lines that don't contain any upper-case characters. This isn't strictly necessary, but there's no point keeping duplicate entries for lower-case words:

      :v/\u/d
      
    3. Convert the entire file to lower-case, ignoring lines that contain the locations of the spell files:

      :v/^#/norm gu$
      
    4. Save the file:

      :w ~/.vim/spell/lowercase.utf-8.add
      
    5. Start using this file in addition to the standard files in Vim's $VIMRUNTIME directory. Note that Vim uses a default 'spellfile' value internally if the setting is empty, so if you already have any existing spell files, you will need to ensure that they are included in this setting (which accepts a comma-delimited list):

      :set spellfile=~/.vim/spell/lowercase.utf-8.add
      

      Note that if you set this option in a running instance of Vim, it doesn't seem to take effect for spell-checking until you interact with it (by, e.g. using the zg command.)

    The above doesn't affect the way that Vim detects lower-case words at the start of a sentence as spelled incorrectly. You can disable this with the 'spellcapcheck' option:

    :set spellcapcheck=