SEARCH

How-To Geek

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.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/9/07

Comments (8)

  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.

  4. Ricky

    Two things:

    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.

  5. The Geek

    I actually really prefer green text… I’ve been using it for years, way before the matrix ever came out.

    I don’t use vim for serious work though… that’s what IDEs are for. I mostly use it when I’m modifying files on a server, or to make quick changes here or there.

  6. Geoffrey

    > Look, somebody puked a rainbow into my terminal window…

    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 …

    I’m OK now, thanks to you.

  7. Cars

    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.

  8. Huffle Puff

    It appears as though everyone has diagnosed his problem incorrectly.

    “Look, somebody puked a rainbow into my terminal window…”

    The problem here is not that you have syntax highlighting turned on. Syntax highlighting makes code more readable. The real problem is that you’re using php.

Enter Your Email Here to Get Access for Free:

Go check your email!