I'd like to change the default font color for comments, which is dark blue to slightly yellow color. It is difficult to read on the black background. I'm using xfce4-terminal, not gvim with GUI.
How do I change only this one color?
So far, I have changed the settings in my 开发者_JS百科~/.profile
file according to "256 colors in vim" using:
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
and
set t_Co=256
in ~/.vimrc
.
Most well-behaving colorschemes will respect the background
setting.
set background=dark
would change the color of comments from dark blue to light blue, when using the default colorscheme.
:hi Comment guifg=#ABCDEF
Pick your color! If using a color terminal, replace guifg=#ABCDEF
with ctermfg=N
with N being a color number.
Also type :help :hi
for more information.
hi Comment ctermfg=LightBlue
Add this to your .vimrc
file which is either in your ~
or the /etc/vim
directory. This will make it permanent. I haven't tested this with gvim.
I also have set background=light
before I set comment color. I like all the colors it created except for the comments.
After searching you can find a decent reference to Vim regarding this issue especially, at "256 colors in vim".
Start with:
:verbose hi
when actually inside Vim, and editing a file.
Then check out how all of the variables have metadata associated with them. Data returned from there makes it real easy to add the desired modifier types into .vimrc. As an example, these are updates I recently added in order to get rid of dark blue, and not have to be tormented by the light blue:
set number background=dark
syntax on
highlight Comment ctermfg=119
highlight Identifier ctermfg=99AA00
If the objective is to make it more readable in the dark background of the text console, the command below is a wonderful option and easy to remember:
:colorscheme evening
But be advised, it will change other element's colors.
See "Syntax Highlighting In VIm".
set background=dark
or
set bg=dark
are the best solution for VIM users!
There are various color schemes in Vim. The "default" color scheme displays comments in a blue color, which makes it hard to read against a black terminal background. I prefer to use the "desert" color scheme which displays in readable colors.
To enable the "desert" color scheme in Vim, use the command :color desert
. If you want to go back to the default use :color default
.
You can even update your ~/.vimrc
with your preferred color scheme using:
echo 'color desert' >> ~/.vimrc
I had the same question and wanted to edit my Comment color from LightBlue to something more toned down, and, following @Benoit's answer, this worked for me:
hi Comment ctermbg=0 ctermfg=DarkGrey
I saved it in my ~/.vimrc file.
0
= Black Background, i.e. Color Terminal Background: ctermbg=0
, and the Foreground text is DarkGrey
, i.e. Color Terminal Foreground: ctermfg=DarkGrey
.
You can check your color scheme first using:
:!ls $VIMRUNTIME/colors
then try whichever suits you best.
精彩评论