Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
  syntax=
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
  syntax=
Hit ENTER or type command to continue
share|improve this question

1 Answer 1

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

 
discard

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.