3

In my .vimrc, I specify that when I do a search, I want the terms to be highlighted - background color yellow, foreground black. Here's how I specify that:

" Settings for terminal version of vim
:highlight Search ctermbg=yellow ctermfg=black
" Settings for gvim (linux) / macvim
:highlight Search guibg=yellow guifg=black

I'm also using a nice color scheme (railscasts) in Macvim. It seems to override my highlighting colors, however, to something barely visible. If I reload my .vimrc, all is well again.

Is there a way to cause my .vimrc settings to win in any conflicts with the color scheme? If not, would it be better to modify the color scheme itself? Write a little script that causes vim to automatically reload the .vimrc after the color scheme loads? What's the best approach here?

3
  • 1
    Have you tried moving this to .gvimrc ? I believe that will be processed after .vimrc.
    – Jack M.
    Nov 15, 2010 at 17:34
  • @Jack M. - that indeed was the problem. If you care to make your comment into an answer, I will accept it. :) Thank you! Nov 16, 2010 at 18:32
  • Update - I am now using the Solarized color scheme, which is very easy to read and, among other things, sets a good highlighting color for me, so I don't have to do the above at all. Nov 14, 2011 at 12:26

2 Answers 2

4

You probably want to move these colours into .gvimrc instead of .vimrc. .gvimrc is processed later as it is intended to override settings and be specific for GVim.

0

Order is important. Are you running these :highlight commands before or after your :colorscheme command? If it's before, try changing the order.

However, there are reasons this still may not work. If this is the case, you can try putting your :highlight commands in ~/.vim/after/syntax/syncolor.vim (I'm not sure what the MacOS equivalent of this path would be), which is automatically loaded on various events.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .