How can i get know what color the syntax highlight is using?
i want to change some color of syntax highlight. i knew there is a rgb database
in X and i can touch it. the problem of the solution is, i wouldn't know what's
the name of the color i want to change.
currently, there are two colors i dont like. the first, those very dark blue
used for comments of c/c++ code; second, the color use to highlight
search-matched word in a file -- it's too ligh to see the word itself.
thanks in advance.
steven woody (id: narke)
Jesse: I heard this story once about when the Germans were occupying
Paris and they had to retreat back. They wired Notre Dame to blow,
but they had to leave one guy in charge of hitting the switch. And
the guy, the soldier, he couldn't do it. You know, he just sat
there, knocked out by how beautiful the place was. And then when
the allied troops came in, they found all the explosives just
lying there and the switch unturned, and they found the same thing
at Sacre Couer, Eiffel Tower. Couple other places I think...
Celine: Is that true?
Jesse: I don't know. I always liked the story, though.
Re: How can i get know what color the syntax highlight is using?
I concur with your opinion regarding the comment highlight color.
Here's my solution, that I use across three disparate platforms:
if $TERM == "cygwin"
hi Comment ctermfg=0 cterm=bold
if $TERM == "teraterm"
hi SpecialKey ctermfg=7
hi Comment ctermfg=0 cterm=bold
hi DiffText ctermfg=0 cterm=NONE
if $TERM_PROGRAM == "Apple_Terminal"
hi Comment ctermbg=0 ctermfg=8 cterm=NONE
hi search ctermfg=0
hi Folded term=NONE ctermfg=7 ctermbg=4
> i want to change some color of syntax highlight. i knew there
> is a rgb database in X and i can touch it. the problem of the
> solution is, i wouldn't know what's the name of the color i
> want to change.
> currently, there are two colors i dont like. the first, those
> very dark blue used for comments of c/c++ code; second, the
> color use to highlight search-matched word in a file -- it's
> too ligh to see the word itself.
Generally one doesn't want to bung with the system files,
redefining the name of, say "cerulian" to some other color.
To change your colors, you can either pick an entirely new
colorsheme, or tweak one that you otherwise like.
To see what colorschemes you have available, type ":colorscheme "
and then hit control+D. This will list the ones you have on your
system. If you find one you like (such as "elflord"), you can
just use that by doing
(or to make it perm., put "colorscheme elflord" in your vimrc file).
If you have one that you *mostly* like, but want to change/tweak
a bit, you can copy the colorscheme to your $HOME/.vim/colors
directory, rename it, and edit it to your heart's desire.
Be sure to change the value of
to that of your file. I've gone the latter route to the extreme
and have my own colorscheme, setting all the colors I prefer.
If you don't know your current colorscheme, you can simply do
Alternatively, you may like some colorscheme, except for a few colors,
or perhaps you'd like to come up with your own colorscheme. For that
purpose you may wish to use hicolors.vim, a plugin which shows you the
standard syntax highlighting group names in their own currently
colorscheme-assigned colors, plus gives you can editor so you can modify
them. That plugin is available at:
On 2005-11-04, Steven Woody <[hidden email]> wrote:
> i want to change some color of syntax highlight. i knew there is a rgb database
> in X and i can touch it. the problem of the solution is, i wouldn't know what's
> the name of the color i want to change.
> currently, there are two colors i dont like. the first, those very dark blue
> used for comments of c/c++ code; second, the color use to highlight
> search-matched word in a file -- it's too ligh to see the word itself.
> thanks in advance.
I agree with others that changing your colorscheme is the easiest
approach. However, that will only get you so far when using a
terminal such as a 16-color xterm. You are limited to the 16 colors
of the xterm's palette.
You can see the colors available by following the instructions at
":help colortest.vim". You can see how vim selects these colors
from the terminal's palette by executing ":hi". Note that the GUI
colors (guifg and guibg) have names while the color terminal colors
(ctermfg and ctermbg) have numbers. The numbers used depend on the
number of colors the terminfo database says your terminal ($TERM)
supports. If you're interested, you can find this out by executing
":set t_Co?". When I do this I get "t_Co=16".
At the bottom of the list returned by ":hi" you will see a set like
Depending on the filetype being edited, the ":hi" list should also
include a definition for the Comment highlight, which by default is:
Comment xxx term=bold ctermfg=4 guifg=Blue
So you can see that on a color terminal, by default, vim uses color
number 4 for comments, which is supposed to be a dark blue.
I always have my xterms set to use a black background. On my
system, color number 4 is so dark as to be useless, so I've
lightened it. You can choose the 8 or 16 colors of your terminal
from the X server's huge palette with statements like these in your
where the right side can be a color name from rgb.txt or a
red-green-blue triplet in hex.
An application such as kcolorchooser can help you tweak the red,
green and blue components for a color you like.
Using the ~/.Xdefaults file this way has helped make the colored
text in vim more readable, but that in mutt and tin more readable,
The highlight that vim uses to highlight search matches is Search
and by default is:
Search xxx term=reverse ctermbg=11 guibg=Yellow
If I'm using PuTTY, I change this with this in my ~/.vimrc: