Chakradar Raju
Chakradar Raju

Reputation: 2811

Is it possible to have syntax on only for active buffer in vim?

syntax on/off affects all buffers.

To set buffer specific syntax highlighting,

:syntax manual
:set syntax=ON/OFF

Before writing a adhoc script that does tracking active buffer and applying syntax=ON only on it, I thought it is better to ask here if there is already a vimcommand doing that.

Upvotes: 1

Views: 144

Answers (1)

Kent
Kent

Reputation: 195079

dirty and quick

use autocmd, when BufEnter, setlocal syntax=on; when BufLeave setlocal syntax=off.

Note, You should use setlocal, not set

Upvotes: 3

Related Questions