Change font color for comments in vim

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. Could you advise me how to change only this one color? I'm satisfied with the other colors.

I'm using xfce4-terminal (not gvim with GUI).

So far, I have done the settings in ~/.profile file according to this link as follows

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

thank you


Solution 1:

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.

Solution 2:

: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.

Solution 3:

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.

Solution 4:

After a bit searching one can find a decent reference to vim, regarding this issue especially, over at http://vim.wikia.com/wiki/256_colors_in_vim. A decent place to get started though, is via: be :verbose hi when actually inside vim, and editing a file. Then check out how all of the variables have had metadata associated with them. Data returned from there, make 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 tormented by the light blue, as a consequence:

    set number background=dark
    syntax on
    highlight Comment    ctermfg=119
    highlight Identifier ctermfg=99AA00

Solution 5:

If the objective is to make it more readable in the dard background of the texto console, the comand below has proven me to be a wonderful option and easiser to remember:

:colorscheme evening

But be advised, it will change other element's colors.