2

How do I turn vi colors off? I was using vim-tiny on on Ubuntu 14.04. Installed vim-nox. Version is version 7.4.52. Once I installed that, I got all these syntax colors by default. I have my Terminal set to a black background with bright green text. Now when I use vi with the colors, some of the text is unreadable against the dark background. I would rather just turn the colors off. How do I do this?

  • 2
    Side note: you might want to explore the vim color themes as well. Perhaps you'd find one that looks nice with your settings. Type :color and tab through the possible arguments. I use a black background for my terminal (with gray text) and I personally like the desert theme. – Shahbaz Apr 3 '16 at 5:26
  • 1
    Syntax highlighting is off by default. If you don't want it, why do you even enable it? – romainl Apr 3 '16 at 8:50
  • @Shabaz Thank you for your helpful remarks. I will explore the themes, and maybe find something appropriate. :-) – gracious1 Apr 3 '16 at 9:18
  • 1
    @romainl On Debian, the detault /etc/vim/vimrc has syntax on. – Martin Tournoij Apr 3 '16 at 13:48
  • 1
    Oh, no, I was wrong. I'm using pi-rho's PPA, and pi-rho does have it commented out where Ubuntu's /etc/vim/vimrc doesn't. Looks like @Carpetsmoker was right. – muru Apr 3 '16 at 14:29
6

You can use:

:set t_Co=0

This will tell Vim that you're not using a colour terminal. The difference with using :syntax off is that this will still enable some syntax highlighting features with bold, underlined, and "reverse video".

  • 1
    Hmm... I think I still want to see bold. I think I was able to see bold and some other formats with vim-tiny, so I wouldn't want to completely lose functionality. Thanks for your helpful answer. – gracious1 Apr 3 '16 at 9:22
  • @gracious1 This will enable bold/underline, :syntax off *won't. ;-) – Martin Tournoij Apr 3 '16 at 13:46
  • Yes, that's what I meant! – gracious1 Apr 3 '16 at 14:25
5

Just discovered this after viewing /etc/vim/vimrc for the first time. Uncommenting the line "set background=dark" in vimrc solves my readability problem also. It changes the syntax colors so that they are distinguishable against my black background! This is actually better than what I had hoped for in the original question!

(Presumably :set background=dark would have worked, too? Or something like that?)

  • 1
    Yes, :set background=dark would have worked. You could add that to ~/.vimrc or ~/.vim/vimrc as well, instead of modifying files in /etc. – muru Apr 3 '16 at 14:44
2

You can disable syntax highlighting by doing:

:syntax off

To turn it back on:

:syntax enable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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