Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change syntax color in vim?

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?

like image 365
unholysampler Avatar asked Dec 11 '09 18:12

unholysampler


People also ask

How do I change the theme color in vim?

Listing available color schemesAfter typing the command, press “Tab”. This will open a list of all the available color schemes. If you keep pressing “Tab”, Vim will cycle through all of them.

Does vim have syntax highlighting?

VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn't show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file.

How do I turn on syntax highlighting in vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.


2 Answers

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.

like image 109
sth Avatar answered Nov 09 '22 04:11

sth


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.

like image 33
Brian Agnew Avatar answered Nov 09 '22 06:11

Brian Agnew