Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use vim to browse the source code. In java source files comments appear in blue color on black background which is difficult to read, how to change this color scheme so that comments can appear in somewhat brighter color.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Create your own colour scheme. The easiest way to do this is to copy an existing one and tweak the line that specifies the colour. For most colour schemes, this will typically look something like this:

hi Comment  guifg=#80a0ff ctermfg=darkred

Simply change this to whatever colour you want. If you're using the default colour scheme, you could simply make a new one called (e.g.) ~/.vim/colors/suresh.vim (the path will need to be different if you're on Windows - see :help rtp) with contents like this:

hi clear
if exists("syntax_on")
    syntax reset
endif

let colors_name = "suresh"

hi Comment  guifg=#80a0ff ctermfg=darkred

I've created a colour scheme that uses a slightly different declaration format to make it a bit easier to edit (the standard one gets a bit difficult to maintain with a lot of colours and support for light and dark backgrounds). This is available here if you're interested. This self highlights, so it's easy to make a change, enter :w and see the colour that will actually be highlighted. However, if you just want to change one colour, it may be easier to just stick to the examples above.

share|improve this answer
1  
It's not really necessary to create a full color shceme of your own. I just use the syncolor file that is always sourced by Vim. See ":help syncolor". –  Heptite Dec 20 '10 at 18:59

Adding this to ~/.vimrc makes the blue a tad brighter (and readable) in my black-backgrounded terminals thus far:

hi comment ctermfg=blue

(Had the same "can't read blue-on-black probs described in original post until employing above. Simple to operationalize when continually working in new accounts/machines like I do. This answer may be more robust for "proper" account setup, but changes the comment to color to red, and seems to require more work to employ.)

share|improve this answer
    
Thanks. "hi Comment ctermfg=red" works for me to make it red. –  user77830 Dec 15 '11 at 4:52

The Ubuntu terminal has a dark purple background by default, and comments in Vim are basically unreadable.

Using the following setting, either in ~/.vimrc or directly in vim (after pressing the : key) sorted out the problem for me:

set background=dark
share|improve this answer

Your Answer

 
discard

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.