问题
I am using Vim on Cygwin. And I am trying to use desert color scheme. In gVim it looks like this:
http://i.stack.imgur.com/FNaVa.png
But in my MinTTY terminal it looks like this:
http://i.stack.imgur.com/dYPkF.png
Is there way to fix it?
My TERM variable is set to xterm-256color. Also, I have added t_Co=256 to my .vimrc file. But it doesn't help.
P.S. I have already found some solution. I can fix it using CSApprox/guicolorscheme plugins. However, is there way to fix it not using plugins?
回答1:
Try grabbing the RGB 0xRRGGBB
values for the colors from inside the desert color scheme definition for vim
and plugging them into MinTTY using the technique below. Then you can rewrite the color scheme (probably after making a copy under a new name, first) to use your newly defined colors (in the 0-15 range). You can put the echo
commands into your .bashrc
so they will be setup for every MinTTY terminal that is opened.
From http://code.google.com/p/mintty/wiki/Tips:
Changing colours
The default foreground, background and cursor colours can be changed in the options dialog, or by specifying the ForegroundColour, BackgroundColour and CursorColour settings in the configuration file or on the command line.
However, they can also be changed from within the terminal using the xterm control sequences for this purpose, for example:
echo -ne '\e]10;#000000\a' # Black foreground
echo -ne '\e]11;#C0C0C0\a' # Light gray background
echo -ne '\e]12;#00FF00\a' # Green cursor
In mintty, the RGB colour values can also be specified using a comma-separated decimal notation, for example 255,0,0 instead of #FF0000 for red. X11 colour names are not currently supported though.
The 16 ANSI colours can be set in the configuration file or on the command line using settings such as Blue or BoldMagenta. These are documented in the configuration section of the manual. They can also be changed using xterm control sequences. Here they are with their default values:
echo -ne '\e]4;0;#000000\a' # black
echo -ne '\e]4;1;#BF0000\a' # red
echo -ne '\e]4;2;#00BF00\a' # green
echo -ne '\e]4;3;#BFBF00\a' # yellow
echo -ne '\e]4;4;#0000BF\a' # blue
echo -ne '\e]4;5;#BF00BF\a' # magenta
echo -ne '\e]4;6;#00BFBF\a' # cyan
echo -ne '\e]4;7;#BFBFBF\a' # white (light grey really)
echo -ne '\e]4;8;#404040\a' # bold black (i.e. dark grey)
echo -ne '\e]4;9;#FF4040\a' # bold red
echo -ne '\e]4;10;#40FF40\a' # bold green
echo -ne '\e]4;11;#FFFF40\a' # bold yellow
echo -ne '\e]4;12;#6060FF\a' # bold blue
echo -ne '\e]4;13;#FF40FF\a' # bold magenta
echo -ne '\e]4;14;#40FFFF\a' # bold cyan
echo -ne '\e]4;15;#FFFFFF\a' # bold white
回答2:
If you're using cygwin, then why use the under-featured mintty? Use xterm and you have 256 colors to chose each vim color from plus all the goodies of a real terminal.
来源:https://stackoverflow.com/questions/24229406/how-to-get-vim-on-cygwin-to-display-right-colors