2

1) To underline misspelled words, I can execute the following in an open buffer:

:hi clear SpellBad
:hi SpellBad cterm=underline
:set spell

2) However, if I write in my .vimrc the first two lines, namely:

:hi clear SpellBad
:hi SpellBad cterm=underline

and when I open a file, I execute :set spell, misspelled words are highlighted in color, but not underlined.

Why are the .vimrc settings in 2) overridden? How can I get the same result as in 1)?

2 Answers 2

4

They are likely overridden by your colorscheme of choice (even if it is default).

My suggested fix is

augroup colors
  au!
  au ColorScheme * hi whatever
augroup
1

D. Ben"s answer is correct one but a bit terse.

I also answered a similar question with detailed solution at How to set a colorscheme that still shows spelling errors?

au is very useful!

Your Answer

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

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