Change syntax color in vim?

VimColorsSyntax Highlighting

Vim Problem Overview


I have syntax highlighting on, but comments are set to dark blue. This hard for me to read against a black terminal. How do I change it so that the comments are colored green instead?

Vim Solutions


Solution 1 - Vim

Probably you just need to tell vim that you have a dark background:

:set background=dark

This should change the highlighting to something better readable.

Solution 2 - Vim

Take a look at syncolor.vim. You'll find it in /usr/share/vim/vim{version}/syntax/.

Excerpt:

" There are two sets of defaults: for a dark and a light background.
if &background == "dark"
  SynColor Comment	term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
  SynColor Constant	term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE
  SynColor Special	term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE

So the first SynColor line looks of interest. I confess I don't know if you can override this, as opposed to changing this file.

Solution 3 - Vim

If you want to change the color of a comment without changing the background, you can use the highlight command. Vim documentation on :highlight

For example, :hi Comment term=bold ctermfg=Cyan guifg=#80a0ff gui=bold

Solution 4 - Vim

$VIMRUNTIME/colors/README.txt (on my system, /usr/share/vim/vim72/colors)

Solution 5 - Vim

You can set colorsheme to desert. Default in e.g. Ubuntu 16.04

Solution 6 - Vim

best way is to change colorscheme to another (lighter) one:

in navigation mode type:

:colorscheme space Ctl+D

and then type the scheme name Enter

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionunholysamplerView Question on Stackoverflow
Solution 1 - VimsthView Answer on Stackoverflow
Solution 2 - VimBrian AgnewView Answer on Stackoverflow
Solution 3 - VimkejadlenView Answer on Stackoverflow
Solution 4 - VimJonathan FeinbergView Answer on Stackoverflow
Solution 5 - VimMotte001View Answer on Stackoverflow
Solution 6 - Vimuser3192295View Answer on Stackoverflow