Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On searching how to set syntax highlighting on in vim, I found this page which says that vimrc should have the following line

syntax on

Why is it not something like set syntax on? Like we have set nu, set ai etc.

With set syntax on, I get this error

$ vi
Error detected while processing /home/lazer/.vimrc:
line   30:
E518: Unknown option: on
Hit ENTER or type command to continue

and with set syntax, I get this

$ vi
Hit ENTER or type command to continue
share|improve this question

It should be syntax on or syntax off.

set syntax=something is used to change the current syntax (c, perl, nasm, etc).

UPDATE: As @garyjohn pointed in comments, it's possible to turn it on/off for the current buffer and its corresponding filetype using set syntax=ON and set syntax=OFF.

share|improve this answer
You can also use set syntax=OFF to turn off syntax highlighting for the current buffer and set syntax=ON to enable syntax highlighting for the current buffer according to the current filetype. – garyjohn Oct 18 '10 at 15:20
@garyjohn: ohh, thanks! Updated accordingly. – jweyrich Oct 18 '10 at 20:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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