How do I change the highlight style in Vim spellcheck?

mkc picture mkc · May 15, 2011 · Viewed 26.6k times · Source

Right now, when I do :set spell in my Vim, I get spelling errors highlighted as if they are selected text. What I want is an MS-Word like underlining of spelling errors. I tried to lookup :help spell but could not find a clue. Any help is appreciated.

Answer

ZyX picture ZyX · May 15, 2011

Spelling errors are highlighted using the SpellBad highlighting group. To get it highlighted as you want, you should put something like

hi clear SpellBad
hi SpellBad cterm=underline
" Set style for gVim
hi SpellBad gui=undercurl

after the last line that is altering the color scheme in your vimrc (it is either set background=(dark|light) or colorscheme {schemename}).

See also :h hl-SpellBad for names and descriptions of other Spell* highlight groups.