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?

link|improve this question
feedback

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.

link|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
feedback

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.

link|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
feedback

Your Answer

 
or
required, but never shown

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