how to turn off gvim error highlighting?

I use gvim as my text editor and the syntax coloring is great except it highlights "errors" and gives it a white background with red font. How do I turn off error highlighting? I find it annoying and don't need it.


The highlight of error messages is determined by the Error and/or ErrorMsg highlight groups. I'm not sure which one you're seeing, so you might as well disable both. You can see how each group is defined by executing, e.g.,

:hi Error

which will show you, in color, a line like this:

Error          xxx term=reverse cterm=bold ctermfg=7 ctermbg=1 guifg=White guibg=Red

The easiest way to clear those settings is to execute

:hi Error NONE
:hi ErrorMsg NONE

If you never set any colorschemes, I think you can just put those commands in your ~/.vimrc, after any :filetype, :syn or :colorscheme commands. If you change color schemes, you will need to do something like using autocommands to make sure those highlight groups are always clear, e.g.,

au ColorScheme * hi Error NONE
au ColorScheme * hi ErrorMsg NONE
au GuiEnter * hi Error NONE
au GuiEnter * hi ErrorMsg NONE

The GuiEnter autocommands account for the behavior of Vim when invoked as gvim, which is to defer some color setting until after ~/.vimrc is read and the GUI is brought up.