Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a color scheme that I really like for the terminal on my Linux box. I have edited Terminal.app's color scheme on my Mac to be identical to on my Linux box, and for the most part I am happy. I also am using the same .vimrc on the two machines, so code looks pretty much the same on the two different platforms. The one thing that is different is the highlighted text background color that appears when set hlsearch is in the .vimrc.

On my Linux box, the highlight background color is the same color that is used for statements (i.e. if or for in pretty much every language I've tried) and the foreground color gets inverted if it matches the background. However, on my Mac it is a jarring bright yellow color that is not part of my color scheme at all and no color inversion takes place with the foreground. I would like to change the highlighting background colort to be the same color as statements, just like on my Linux box. It would be a plus if I could get the foreground and background colors to switch like on Linux, too. I have checked the /usr/share/vim/vimrc files, and both systems (Mac and Debian) have nothing in them pertaining to highlighting, as far as I can tell. Mac doesn't have an /etc/vim/vimrc.

Any ideas on how to edit this?

share|improve this question
2  
Execute :hi Search to see how Vim is highlighting your search results. You might also try :set bg? t_Co? to see if those settings are different. Vim tries to guess the correct value of 'bg' from your $TERM and uses the terminfo database to get the value of 't_Co'. Some terminals use color for attributes such as reverse, bold and underline. Those settings might be different between your Mac and Linux terminals. –  garyjohn May 16 '12 at 15:13
1  
@garyjohn Thank you so much! It turns out that on Linux t_Co=8, but on Mac t_Co=256. I changed t_Co=8 on Mac, and everything is fixed! I don't have enough privilege to upvote your comment, otherwise I would. If you post your comment as an answer then I'll definitely upvote it. –  SethMMorton May 16 '12 at 15:39

1 Answer 1

up vote 2 down vote accepted

Here are some things you might try. Execute :hi Search to see how Vim is highlighting your search results. You might also try :set bg? t_Co? to see if those settings are different. Vim tries to guess the correct value of 'bg' from your $TERM and uses the terminfo database to get the value of 't_Co'. Some terminals use color for attributes such as reverse, bold and underline. Those settings might be different between your Mac and Linux terminals.

share|improve this answer
    
As noted in the comment for the question, the key was to add the line set t_Co=8 in my .vimrc on my Mac. –  SethMMorton May 16 '12 at 16:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.