1

Is there a way to turn off syntax for only the current buffer/split windows? like for example, you can set map <buffer> or setlocal. Is there something similar for the syntax option ?

I use the :diffsplit command in vim quite a bit, for which I prefer to disable syntax and but this turns off highlighting for all buffers. I am using the following settings :

" turn off syntax when started from terminal
if &diff 
    syntax off
endif 
" turn off syntax when started from inside vim 
au OptionSet diff syntax off
3

Buffers and windows are different things.

To clear syntax for a particular buffer you can set the syntax option to empty string (or even simply do :syntax clear which should be the same for most purposes).

To clear syntax in a particular window you could use :ownsyntax off.

  • 1
    thanks that was helpful. :ownsyntax off does the trick. Is there a way to turn the syntax back on automatically after :q uitting from one of the windows using some kind of autocommand ? – First User Nov 23 '20 at 20:23
  • 1
    @FirstUser Obviously, &diff will be auto-reset after only single "diffed"-window remains open. – Matt Nov 24 '20 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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