Subscribe to How-To Geek

Recommended: Click Here to Run a Free Scan for Common PC Errors   [Sponsored Link]

Disable Syntax Highlighting in Vim

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…

image

Disable for Current Session

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

image

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.

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 09/9/07 and tagged with: Linux

Comments (3)

  1. Daniel Spiewak

    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.

    Daniel

  2. The Geek

    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.

  3. robert

    Try Monaco on OS X, but also check the "Antialias text" box or it will suck. I use 13pt, because my eyesight is slowly failing.


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.