Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mostly I edit ruby files, although shell script file comments are also #

Currently my comments show as dark blue on black which is really hard to read.

See screenshot.

How can I change their color?

I'm willing to conside different schemas for all colors though I do like the black background as a base.

enter image description here

share|improve this question
I like a contrasting background for comments -- it sets them off from the code, eg. hi Comment ctermbg=gray ctermfg=darkblue. You can set your color scheme and then change it bit by bit; put the bits in a seperate file and source it from your vimrc at the end. – goldilocks Aug 30 '13 at 16:05
:colorscheme evening I love it. It has a dark background. The colors .... well they pierce the darkest of evil :-) – Bananguin Aug 30 '13 at 19:33
up vote 79 down vote accepted

There are many color schemes which are usually distributed together with vim. You can select them with the :color command.

You can see the available color schemes in vim's colors folder, for example in my case:

$ ls /usr/share/vim/vimNN/colors/ # where vimNN is vim version, e.g. vim74
blue.vim  darkblue.vim  default.vim  delek.vim  desert.vim  elflord.vim 
evening.vim  koehler.vim  morning.vim  murphy.vim  pablo.vim  peachpuff.vim
README.txt  ron.vim  shine.vim  slate.vim  torte.vim  zellner.vim

I usually use desert. So I open vim, then enter :color desert and enter. To have the color scheme by default every time you open vim, add :color desert into your ~/.vimrc.

(Michael, OP) This was good. The terminal looks like:

enter image description here

share|improve this answer

As you are using a dark background in your terminal, you simply need to set

:set background=dark

instead of the default

:set background=light

The colors are then automatically correctly set.

If you want to have this permanently, add the line

set background=dark

to your $HOME/.vimrc file.

share|improve this answer
While the accepted answer has useful information, this answer is far more concise about the root cause of the problem for folks like myself who prefer a dark themed terminal window. – Mark Edington Oct 5 '15 at 5:16
Unfortunately this still uses that almost unreadable dark blue in places. – rooby Mar 8 at 0:32
@rooby Often, you can change the default colors in your terminal emulator, see also the other answers. – jofel Mar 8 at 9:23

You can do it manually with this command:

:hi Comment guifg=#ABCDEF

Where ABCDEF is an appropriate color hex code.

To make it permanent, you will need to add these lines to your ~/.vimrc file (using green as an example):

syntax on
:highlight Comment ctermfg=green
share|improve this answer
It's also possible to see your current highlight settings with :hi or :highlight (i.e. without any other arguments). – evilsoup Aug 30 '13 at 16:30
You can also change other types such as strings in supporting document types, example :highlight String ctermfg=green – aggregate1166877 Jun 22 at 15:34

One option I found was in terminal preferences (top menu, not the window).

This has profile preferences and then a color tab, e.g.

enter image description here

Changing the Palette entry 5 from Dark blue to Light Lilac helped. I finally chose xterm as the color scheme and lightened up the comment color e.g.enter image description here

share|improve this answer
My only question now is if whether I can now save those preferences in a file so that they are there for a new machine setup. – Michael Durrant Aug 30 '13 at 14:43
I use xterm, and set the blue color to something palatable to my eyes in .Xresources: "XTerm*color4: light sky blue". – holygeek Aug 31 '13 at 15:00
+1 It is usually a question of color palette. – polemon Sep 1 '13 at 8:07
+1 holygeek, that basically what I ended up doing. – Michael Durrant Sep 1 '13 at 12:35

I had precisely this problem a little while ago, the solution is to place the following line in your vimrc file:

set t_Co=256

And then you might have to put the following at the end of your your ~/.profile:

#set vim terminal to 256 colors.
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
    export TERM='xterm-256color'
    export TERM='xterm-color'

and then you can set:

hi Comment      ctermfg=lightblue

in your vimrc file and then you will have light blue comments.
vimrc 256: http://vim.wikia.com/wiki/256_colors_in_vim

I also noticed the screen became somewhat prettier by setting it to 256.

share|improve this answer

If on a dark background in Debian, then uncommenting set background=dark in /etc/vim/vimrc helps, too.

Or, if you don't want to interfere with the package's config file, rather in (a new)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.