I want hi SpellBad to be red (167 or #fb4934) and underlined. What I have right now is this:

...in vimrc...

setlocal spell
set spelllang=en_gb
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
autocmd vimenter * ++nested colorscheme gruvbox

...some setup stuff for gruvbox...

hi clear SpellBad
hi SpellBad term=reverse
hi SpellBad cterm=underline ctermfg=235 ctermbg=167 ctermul=167
hi SpellBad gui=undercurl guifg=#282828 guibg=#fb4934 guisp=#fb4934
hi clear SpellCap 
hi SpellCap term=reverse
hi SpellCap cterm=underline ctermfg=235 ctermbg=167 ctermul=167
hi SpellCap gui=undercurl guifg=#282828 guibg=#fb4934 guisp=#fb4934

This has succeeded differentiating misspelled words. And make them blink incessantly...

:hi SpellBad gives this:

SpellBad    xxx (blinking) term=reverse cterm=undercurl ctermul=167 gui=undercurl guisp=#83a598

I do everything from terminal.

How do I get my misspelled words to be red and underlined?

Imaginary bonus points: ignore misspelling in comments so it is the regular Comment style

1 Answer 1


I figured it out.

There are two parts to this problem: the blinking and the color

Let's start with the blinking (because it's easier to understand):

I was including ctermul, this doesn't really work for some reason and by removing this, the blinking stopped.

For the bad color: I put the highlight changes in an autocommand, like so:

function! MyHighlights() abort
    hi SpellBad term=NONE cterm=underline ctermfg=xxx gui=undercurl guifg=#yyyyyy

augroup MyColors
    autocmd ColorScheme * call MyHighlights()
augroup END


autocmd vimenter * ++nested colorscheme gruvbox

Replace xxx with a number 0 to 256 (as for the 256 colors of terminal) and yyyyyy with whatever hex color code. You can get rid of the cterm or gui variables if you don't use terminal vim or gVim respectively. For more things you can customize the colors of, check out :h hi, :h hl-ColorColumn (:h hl-SpellBad brings you to the same place but ColorColumn is at the top of the list), and :hi.

The only annoyance now is that misspelled words in comments are also highlighted. I will edit this once I figure out that issue.

  • I would say that comments is the only place where you would want misspelled words to be highlighted.
    – romainl
    Commented May 5, 2023 at 11:48

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.