Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem running Vim. I am editing files with recognisable file extensions - .xml, .php - however the text is black. This would not be a problem except I run terminal windows with a black background.

I can get to see my files by setting the terminal session to have a white background, but I would like a fix rather than a workaround.

I have renamed/moved the .vim and .viminfo files in my home directory but that has not magically restored my vim settings (that were fine yesterday morning).

Any ideas?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Try informing vim that your terminal has a black background with :set bg=dark. If your text is still black, try setting an environment variable that says your terminal is capable of color before you start vim by running export TERM=xterm-color.

share|improve this answer
    
Thank you very much for such a speedy reply! That worked a treat. –  Mathew Jun 2 '11 at 9:39
2  
Add whichever one of those fixed your issue to either ~/.vimrc or ~/.bashrc to make it a permanent preference. –  Caleb Jun 2 '11 at 9:52
    
...I won't yet! I will reboot and see what happens. If there is no need then I will get a more definitive answer to post here. Obviously, running Ubuntu I only hibernate rather than reboot... –  Mathew Jun 2 '11 at 11:21
add comment

I'm new to this site.

You can definitively set your background color in $HOME/(.)vimrc by writing the line

set bg=dark

I hope this help you.

share|improve this answer
    
Thanks for the tip - I cleared out my .vim* files and the colour scheme still persisted, even in new terminal windows. :set bg=dark worked for me, still not sure why! –  Mathew Jun 2 '11 at 9:40
    
And welcome to SE - you will enjoy it...! –  Mathew Jun 2 '11 at 9:41
add comment

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.