I’m writing a tutorial/book with Vim, and I’d like to turn off the syntax highlighting for a block of text (the normal text of the book) and reactivate it for the code examples.
I have Googled to no end, but I cannot find a simple solution. Am I missing something? Or is this not achievable in Vim?
I have written the SyntaxRange plugin for that (my main use case is highlighting patches inside emails as with the “diff” syntax). With it, you can
:[range]SyntaxIgnoreor:[range]SyntaxInclude {filetype}certain sections of a buffer, or, when the sections start and end with certain markers, define dynamic sections that adapt when the number of lines change.