rcplusplus
rcplusplus

Reputation: 2877

Vim/YCM - change warning highlight color

I'm using the YouCompleteMe plugin for vim on Mac OSX, primarily for C++. Right now it highlights both errors and warnings in a pinkish color, but I want warnings to be highlighted in a yellow-ish sort of color. I think I'm supposed to place these 3 lines somewhere:

highlight YcmWarningLine guibg=#ffffcc
highlight YcmWarningSign guibg=#ffffcc
highlight YcmWarningSection guibg=#ffffcc

Problem is I don't know which file to place them in. Where do I place them, and in general am I going about this the right way?

Upvotes: 1

Views: 2922

Answers (2)

杨锦修
杨锦修

Reputation: 21

Those and other vim configuration settings should be added to your ~/.vimrc.

Upvotes: 1

Ingo Karkat
Ingo Karkat

Reputation: 172738

Highlight groups are global, only the syntax definitions that parse individual filetypes are specific. Syntax scripts canonically use :hi def to avoid overriding group definitions already customized by the user. Therefore, it is sufficient to place those commands into your ~/.vimrc, but after any :colorscheme command.

If you switch colorschemes on the fly (without restarting Vim), you'll notice that your custom highlightings will disappear. To keep them, you additionally need to reinstall them. Duplicate the :hi commands and prepend

:autocmd ColorScheme *

to them.

Upvotes: 1

Related Questions