9

My Problem

I have added the following to my .vimrc to enable spell checks:

" Spell Checking
set spelllang=en_us
set spellfile=$HOME/en.utf-8.add
set spell

Giving the following highlight:

enter image description here

Both "permalink" and "Serverless" are marked as errors, and are reachable with ]s. However, one is cyan and the other is red, and I want to know their difference.

What Have I Tried

  • Searching for "vim spell check colors" and alike
  • RTFM and help spell

My Question

What is the meaning of the different spell check highlight colors in vim?

1 Answer 1

11

If your highlighting is like mine then that would be a SpellLocal error.

SpellLocal Word that is recognized by the spellchecker as one that is used in another region.

And...

A word may be spelled differently in various regions. For example, English comes in (at least) these variants:

en: all regions
en_au: Australia
en_ca: Canada
en_gb: Great Britain
en_nz: New Zealand
en_us: USA

Words that are not used in one region but are used in another region are highlighted with SpellLocal

You should be able to confirm this by running the following command which will show highlight settings for just spell check related elements.

:for item in ['Bad','Cap','Local','Rare']| exe "hi Spell".item| endfor

Here's what I see (SpellLocal is Cyan...might also show as #008787)

SpellBad       xxx term=reverse ctermbg=12 gui=undercurl guisp=Red
                   links to Error
SpellCap       xxx term=reverse ctermbg=9 gui=undercurl guisp=Blue
                   links to Error
SpellLocal     xxx term=underline ctermbg=11 gui=undercurl guisp=Cyan
                   links to Error
SpellRare      xxx term=reverse ctermbg=13 gui=undercurl guisp=Magenta
                   links to Error

See :h spell-quickstart and :h spell-remarks. The first one has these short descriptions of all four error types along with tag links to further help:

SpellBad    word not recognized         |hl-SpellBad|    
SpellCap    word not capitalised        |hl-SpellCap|    
SpellRare   rare word                   |hl-SpellRare|    
SpellLocal  wrong spelling for region   |hl-SpellLocal|

Update: Thought I'd add an example of how to see SpellLocal in action. The region is specified with the 'spelllang' option. In my versions of Vim this is set to "en" by default which allows all regional spellings. However if I do :set spelllang=en_us and then check spelling of "green is the colour" then "colour" will be highlighted in cyan since that is not considered a correct spelling of "color" in the U.S. but is valid in other regions such as "en_gb".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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