The SpellBad
highlighting group should allow you to configure the appearance of misspelled words.
Let's say you want them to be red on yellow background. Then you could add the following code somewhere in your vimrc file or in your colorscheme file (but in any case after the colorscheme has set up the SpellBad
group, otherwise it would override your settings):
:highlight clear SpellBad
:highlight SpellBad ctermfg=009 ctermbg=011 guifg=#ff0000 guibg=#ffff00
The ctermfg
, ctermbg
arguments control the colors of the foreground and background colors in a terminal while guifg
, guibg
do the same for vim inside a gui.
For the terminal, the colors can be expressed with a name (red, yellow...) or a decimal code between 000 and 007 / 015 / 255 when it supports 8 / 16 / 256 colors.
You can check how many colors it supports from vim with: echo &t_Co
For a gui, the colors can be expressed with a name or a code in hexadecimal.
Here's a chart which shows codes for some colors.
There are other highlighting groups (SpellCap
, SpellLocal
and SpellRare
) which control the appearance of other kinds of words.
Note that setting the 'background'
option causes your colorscheme to be reloaded.
So if you have set background=dark
somewhere in your vimrc, put the previous code which changes the SpellBad
group after that line, otherwise the colorscheme will again override your settings.
For more information, see:
:help hl-SpellBad