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 don't understand how to get the "correct" colors in terminal vim. My .vimrc file looks like:

syntax enable
colorscheme desert256

I am doing this on a black background in Terminal in Mac OS X Lion. But when I execute vim, I get the colors, but I notice that set background=light when it should be dark (vim always seems to guess wrong on the background). So if I do a set background=dark the colors change but then if I type colorscheme, vim reports that I am back to default.

Should I be using syntax on or some other command?

Please provide some guidance on how to properly do syntax highlighting in terminal vim.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Found this snippet from zenburn.vim.

" * Work-around to a Vim bug, it seems to misinterpret ctermfg and 234 and 237            
"   as light values, and sets background to light for some people. If you have            
"   this problem, use:                                                                    

"   let g:zenburn_force_dark_Background = 1        

if exists("g:zenburn_force_dark_Background")
    " Force dark background, because of a bug in VIM:  VIM sets background
    " automatically during "hi Normal ctermfg=X"; it misinterprets the high
    " value (234 or 237 above) as a light color, and wrongly sets background to
    " light.  See ":help highlight" for details.
    set background=dark
endif

To fix this, just add

set background=dark

to the end of desert256.vim after all the highlighting.

share|improve this answer
    
ok, but if I do this, it still reports default as the color scheme (even though the colors are different than default) - Guess its ok as a workaround... –  Jason Waldrop Oct 13 '11 at 13:05
    
@JasonWaldrop Hmm, it returns desert256 for me. –  Jin Oct 13 '11 at 13:26

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.