2

I want to disable syntax highlighting for a particular programming language. I'm currently using this

au FileType foo    syntax off

however this has the problem that it disables syntax highlighting for any new buffers that I open in the same window, even when they have different filetypes. Is it possible to disable syntax highlighting only for this filetype? (e.g. any other buffers in the same window that has different filetype should have syntax highlighting enabled)

One of the things that could solve this problem is to create a syntax/foo.vim file that doesn't highlight anything, but I'm not sure how to implement this when foo is one of the languages that vim highlights by default.

sinan
  • 6,809
  • 6
  • 38
  • 67
  • Possible duplicate of [Disable syntax highlighting for certain filenames](https://stackoverflow.com/questions/27440400/disable-syntax-highlighting-for-certain-filenames) – K. Dackow Aug 02 '18 at 17:07
  • This is not a duplicate of the linked question. – sinan Aug 02 '18 at 17:38

1 Answers1

2
au FileType foo setlocal syntax=OFF

If you want to isolate the config a bit, create a file called ~/.vim/after/ftplugin/foo.vim and put this in it:

setlocal syntax=OFF
Jim Stewart
  • 16,964
  • 5
  • 69
  • 89