title: Vim: Restart Syntax Highlighting from Arbitrary Line
body: <p>I have discovered an interesting edge-case in Vim syntax highlighting.  Consider the following snippet from a company Makefile:</p>
  
  <pre><code>LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
  </code></pre>
  
  <p>The above line simply removes double quotes from a given <code>LDSCRIPT</code>.  Nothing syntactically wrong; the make runs as expected and without issue.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>Since the above line only contains one double quote, the highlighting rules mistakenly think that the rest of the body of the Makefile is quoted text and colors it as such.  For simple Makefiles, this is an inconvenience; for 1KLOC+ Makefiles, this becomes a real hassle (especially since this preprocessing is near the top of the file).</p>
  
  <p><strong>The Question</strong></p>
  
  <p>Is there any way to either disable syntax highlighting based on lines that match some given regular expression (eg. <code>subst[ \t]*['"],.*</code>) or something similar?  Failing that, is there some way to restart Vim's highlighting at some arbitrary line while preserving the highlights above?</p>
  
  <p>If at all possible, I would like to avoid edits to the Makefile as this script is shared across a number of departments.</p>
  
  <p>I am willing to write / modify vimscript to achieve this, however I have not done so before (to any reasonable degree).  Any tips, pointers or other helpful hints would be much appreciated.</p>
  
  <p><strong>What I have Tried</strong></p>
  
  <pre><code>:syntax sync minlines=1
  :syntax sync fromstart
  :syntax sync clear
  </code></pre>
  
  <p>None of the above seems to have any effect on the highlighting when run in the editor.  Looking through the Vim help docs, it seems that <code>:syn-sync-fourth</code> may be able to do what I am after, however I am uncertain as to how this would function in an inverse manner (eg. to disable highlighting rather than to apply it).</p>