Search code examples
vimsyntax-highlighting

Enable Syntax highlighting in vim on a per-buffer basis


I currently have to edit some very large XML files, which slows down syntax highlighting to a point where it's absolutely unusable - it takes multiple seconds to update the screen after a search operation, for example.

When disabling syntax highlighting (:syn off), the same operations happen instantaneously. Unfortunately, disabling syntax highlighting appears to happen globally, so all other files now have it disabled as well.

So: Is there a way to only disable syntax highlighting for a given buffer?


Solution

  • You can set :syntax manual and then enable it with set syntax=ON in the buffers you like. Also see :help :syn-manual.