vim

How to change the "Pattern not found" message colors in Vim?


When I perform a search for something in vim, if it's not found, the "Pattern not found" message is a light/white color on a light blue background, which is very difficult to read.

DifficultToRead

How can I change the "Pattern not found" colors? I'm happy with the rest of the color scheme, I just want to change the colors of this (and potentially other) such notifications.


Solution

  • Therefore, assuming your colorscheme is called foobar:

    augroup my_colorscheme_overrides
        autocmd!
        autocmd Colorscheme foobar highlight ErrorMsg ctermbg=red
    augroup END
    

    If you want your override to work for every colorscheme, just use a * for the autocommand pattern:

    augroup my_colorscheme_overrides
        autocmd!
        autocmd Colorscheme * highlight ErrorMsg ctermbg=red
    augroup END
    

    See :help autocommands.

    Note that this should come before any colorscheme foobar in your vimrc.