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 use a terminal with white text on black background (I just like it better), so I wrote the following line in my .vimrc file:

set background=dark

However, gvim has black on white text. How do I do either of the following:

  • Set the background of gvim to black
  • Check in .vimrc if I'm using gvim

I tried this: I started up gvim, and typed echo &term. The answer was "builtin_gui". So I wrote the following into .vimrc:

if &term == "builtin_gui"
    set background=light
else
    set background=dark
endif

Somehow, it didn't work.

share|improve this question

1 Answer 1

up vote 8 down vote accepted

set background does not change the background, but tells vim whether your background is dark or bright (light).

You could use your .gvimrc file to set colors specific to gvim. I set my color scheme to slate, dessert, or evening because I like light-on-dark color schemes:

colorscheme slate

Or you could add this to your .gvimrc or .vimrc to set the colors to white-on-black:

highlight Normal guifg=white guibg=black
share|improve this answer
    
When I start gvim, does both .vimrc and .gvimrc run? –  petersohn May 16 '10 at 8:12
1  
Yes. Anything in .gvimrc should run after .vimrc, so .gvimrc preferences will take precedence over .vimrc. –  Trey Hunner May 16 '10 at 8:20

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.