RSS

How-To Geek

I’m the type of geek that always has an open ssh session connected to my servers, but ever since I switched to using a Mac running OS X, I noticed a huge annoyance in my terminal… the syntax highlighting makes it impossible to read the files I’m trying to edit.

Note that this isn’t the fault of OS X, it’s because I’ve got ansi color turned on and my settings configured wrong. So, how to disable syntax highlighting in Vim?

Look, somebody puked a rainbow into my terminal window…

Disable for Current Session

If you type :syntax off into the current editor, it’ll turn the syntax highlighting off immediately:

You could use the opposite command, :syntax on, to turn it back on and make your eyes bleed.

Turn Off Permanently (for current user)

In order to turn off highlighting permanently for your user account, you can edit the .vimrc file in your user directory and add the setting to turn off syntax highlighting. Run this command:

vi ~/.vimrc

Add the following line to disable syntax highlighting for your user account:

syntax off

If you wanted to enable highlighting, you could use “syntax on” instead.

Comments (8)

Just a heads up, but part of the problem here is a) you’ve got a green-based font, and b) I think your VIM color settings are still on light background. If you go into /etc/vim/vimrc and dig around a bit, you should be able to find the setting which defines which color scheme to use. Choose the one you want, and then override the setting in ~/.vimrc. After that, syntax highlighting should work nicely without pain.

I changed the setting to :set background=dark, which didn’t seem to change anything…

The other problem is that I haven’t found a console font I like in OS X yet… the default console font is too small, and when you increase the size it’s difficult to read because of the thickness of the letters.

1) Change to white text. Green text is cool in the Matrix, and thats about it.
2) Keep syntax highlighting on. Take this advice from a seasoned veteran–it will make your life easier. First off, with white text, it won’t look like the rainbow monster died on your screen, so you don’t have to worry about that. In addition when the # of programming languages you know exceeds 12, you will find yourself liking syntax highlighting more and more, because it serves as a reminder when your memory becomes fuzzy.

Oh thank you for that bit of humor; I was really getting frustrated this morning. The sysadmins changed the vim defaults, and I was lost in the documentation of how to set up a colorscheme … but I didn’t want to set up a color scheme, I wanted to clear the one that was forced upon me …

Three really nifty green color themes for Vim — Chlordane (Ghost in the Shell-inspired, lots of subtle shifts of green), Matrix (self-explanatory), and Matrix Revolutions. That way you get the benefits of subtle syntax highlighting and your screen looks really cool. :D

There’s also a Matrix screensaver for Vim. Hit :matrix and text scrolls down Matrix-style.