Helmut Granda
Helmut Granda

Reputation: 4705

Vim Highlight Search in vimrc

The following code works in the terminal

hi Search ctermfg=Red ctermbg=White cterm=NONE

As soon as it is added to vimrc, saved, and sourced the search is not highlited. It is highlited in the default color but not in the new color mentioned.

Any tips of why that is happening?

Upvotes: 0

Views: 484

Answers (3)

tig
tig

Reputation: 167

Just put this in your .vimrc.

hi Search cterm=NONE ctermfg=grey ctermbg=blue

looks great in mobaxter or any black background terminal

Upvotes: 1

Tacahiroy
Tacahiroy

Reputation: 693

Your custom highlight will be reset if you change colorscheme. In that case you may use autocmd to achieve that like: autocmd ColorScheme * hi Search ctermfg=Red ctermbg=White cterm=NONE

Upvotes: 0

hobbs
hobbs

Reputation: 240819

If you put your hi command before a colorscheme command in your vimrc, the loaded colorscheme is probably overwriting your highlight with one of its own. Try moving it to after the colorscheme.

Upvotes: 3

Related Questions