13

I have installed vim in Debian 6. I am trying to change color scheme and enable syntax highlighting. But it's not working. I added set background=dark in .vimrc file. But white background is displaying. I wonder what went wrong?

Here is my .vimrc file: http://pastebin.com/8k2gpWDh

I installed robokai colorscheme which has dark background. But the background looks white instead dark. Other colors of colorscheme working.

3
  • 1
    Have you install the full vim? By default, Debian installs only vim-tiny that does not support syntax coloring. Commented Jun 10, 2011 at 16:18
  • Thanks.Added syntax on.I added set background=dark in vimrc file.But background is still white. Commented Jun 10, 2011 at 16:22
  • @Didier Trosset :Installed vim-common and vim-runtime as well Commented Jun 10, 2011 at 16:24

3 Answers 3

14

Make sure you have

syntax on

And then call

color[scheme] {name}

To set your desired colorscheme. These contain the set background=dark you refered, so it should be a matter of choosing the right one. Vim comes with some color schemes, but you may want to install new ones.

This page and this one provide tips on color schemes, and there is a test page very helpful when choosing colorschemes.

Sign up to request clarification or add additional context in comments.

1 Comment

Not nitpicking but it is actually colo[rscheme].
2

robokai seem to be written for a 16 color terminal, a linux console probably, but i am guessing here. To make it work if you are using a terminal emulator (like xterm, gnome-terminal, konsole, etc) you may use set t_Co=16 before loading the color scheme or force your terminal type to linux when running vim (TERM=linux vim ...), and manually set a dark background in your terminal emulator,

Also run dpkg --get-selections | grep vim. For vim to work in full you need to see one of: vim-gnome, vim-gtk, vim-lesstiff or vim-nox (for systems without a graphical desktop).

Comments

2

If you are using a terminal emulator like konsole or gnome-terminal, install vim-gtk or vim-gnome, get CSApprox, and add set t_Co=256 to your .vimrc. This will give you support for any color scheme, in the terminal, even those which supposedly only support gvim.

2 Comments

Thanks! xfce-terminal suddenly changed its compat from xterm to xterm-256color and that messed up my colorscheme. I added set t_Co=8 to the file to restore the previous interpretation of color codes.
Since &t_Co are lifted from the terminfo file (i.e., /usr/share/terminfo/x/xterm+256color file by vim/nvim, setting the TERM to the desired (and valid) setting would save you one less .vimrc statement in setting the 8 bit. Some valid 8-bit $TERM are: xterm-8bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.