简体   繁体   中英

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?

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.

Just put this in your .vimrc .

hi Search cterm=NONE ctermfg=grey ctermbg=blue

looks great in mobaxter or any black background terminal

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM