Vim: Attempting to change the spell check to exclude "rare" words

According to the documentation, :help spell

Vim's built-in spell checker detects 4 types of spelling errors: SpellBad, SpellCap, SpellRare, SpellLocal

I would like to keep SpellBad and SpellLocal, but I want to disable SpellCap and SpellRare. Turning off the backlight is easy enough for them. However, when trying to skip or back to the next / previous misspelled word with ]s

and [s

included the words SpellCap and SpellRare.

I have managed to disable SpellCap by putting it set spellcapcheck=

in my .vimrc, however I cannot find a way to do a similar thing for SpellRare.

Using [s

and ]s

instead of [s

and ]s

would be a good solution, however it will only lead to the next / previous word of the word SpellBad. I want it to include the words SpellBad and SpellLocal.

Anyone now how to do this?

+3


source to share


2 answers


You can override the mappings ]s

to skip rare spell errors (for example, by checking the syntax), but the cleanest approach would be to create custom spellfiles that exclude rare words.



Since they are identified by the ?

( :help spell-RARE

) flag , filtering them should be trivial. Building them ( :help Myspell

) can be more complicated; I haven't done this yet.

+1


source


Ok, so for anyone interested, here is the exact set of instructions how I did it.

  • Add set spellcapcheck=

    to your vimrc. This will disable spell checking for words that are not swallowed after a full break. This is an optional step, create your own mind if you want it or not.
  • Download the complete English dictionaries package (containing all different versions of English) from the Open Office Dictionary archive - link here http://archive.services.openoffice.org/pub/mirror/OpenOffice.org/contrib/dictionaries/en_EN-pack.zip
    Unzip it to a directory and then unzip all the resulting zip files into the same directory.
  • Make sure your terminal is in the directory you just unpacked everything to, and then open Vim or gVim. Then run the command :mkspell xxxxx en_AU en_CA en_GB en_NZ en_US

    (just replace xxxxx with whatever name you want to give your dictionary)
    You will be prompted with numerous duplicate entries. I recommend just holding the 'Enter' button to get it done as quickly as possible.
    If everything works, you should get a file in your directory named xxxxx.utf-8.spl. Move this file to ~ / .vim / spell
  • Put set spelllang=xxxxx_yy

    in your vimrc where yy is a two-letter abbreviation in your desired scope (au, ca, gb, nz, or us)
    From now on, your spell checker should only list misspelled words or words from a different region and none of these annoying "rare" words.


NB Some of you may have noticed that I did not include hyphenation dictionaries (hyph_en_GB and hyph_en_US) when creating the dictionary. It was b / c I, when I tried to include them, spl file was not generating. Perhaps someone else can shed some light on why this is the case and / or how to fix it.

+2


source







All Articles