Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't most vim color schemes look as nice as the screenshot when I use them? [closed]

I have downloaded many vim color schemas and tried them out, but many of them don't look like the official screenshot.

For example, vim's own color schema - desert should look like this: desert color schema

But in my vim, many colors won't display, for example the background. my vim color display

But some color schemas work correctly.

Why is that?

In the: Edit-> Profile Preferences -> Colors, I select the "use colors from system theme"

like image 318
Tanky Woo Avatar asked Mar 23 '12 00:03

Tanky Woo


People also ask

How do I make vim more colorful?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

How do I change the look of vim?

After typing the command, press “Tab”. This will open a list of all the available color schemes. If you keep pressing “Tab”, Vim will cycle through all of them.

Does vim use terminal colors?

Vim color schemes Unlike other utilities, Vim uses 8-bit or 24-bit color schemes that use absolute colors for each highlight group in an attempt to make the colors look the same for every configuration. These schemes don't use any of the named colors, so the terminal's color preferences don't affect them.


2 Answers

Many colorschemes are designed for 256 colors, which is significantly better than a standard 8 color terminal. To make that work, you need $TERM set to a 256 color terminal like xterm-256color.

If you have a 256 color capable terminal (looks like you do from your screenshot if that is Gnome Terminal), set the $TERM to xterm-256color and enable 256 colors in your vimrc with something like:

if $TERM == "xterm-256color"   set t_Co=256 endif 

The Vim wiki has some tips on setting the correct $TERM for different terminal emulators. The easiest way to test this out quickly is to do

TERM=xterm-256color vim  

This will not make colorschemes designed for GUI vim fully compatible with terminal Vim, but will make 256-color colorschemes work, and those are a giant improvement over the standard 8 color colorschemes.

like image 165
Michael Berkowski Avatar answered Sep 24 '22 08:09

Michael Berkowski


On *nix systems, the very purpose of setting the $TERM environment variable to a terminfo entry that describes your terminal's capabilities, including the number of supported colors is to advertise these capabilities to the applications that will run inside your terminal.

In other words, the reason you set this variable in the first place is to tell Vim (or mutt.. slrn.. ELinks.. etc.) .. Hey.. among other things.. I support 256 colors, did you know..?

As a result, there is no point whatsoever in adding bloat to your vimrc to test the value of $TERM in order to set the value of the t_Co Vim variable. Vim is smart enough to pick up the supported number of colors from the terminfo entry pointed to by the $TERM variable. That's why you set it in the first place..!

In this respect, terminal/console Vim simply follows the *nix model and determines the terminal's capabilities from the terminfo entry and automatically sets the contents of the t_Co variable.

Tried and tested on something like 15 different terminal emulations in a GNU/linux environment.

like image 25
guv' Avatar answered Sep 22 '22 08:09

guv'