Conceal/Ownsyntax for Vim

a brief explanation

The patch does come with full docs in Vim format, so the reader is directed to those for a full description of all the options.

Here's a screenshot (click for full size) of an editing session which makes use of the three new features:

1) 'cursorbind'
Both windows have 'cursorbind' set - ok, so you can't actually see this, but trust me ;) So in the screenshot, the cursor is on the word "however" in both windows. The use of 'cursorbind' works well for binding windows of different sizes; obviously in some other circumstances 'scrollbind' is still the better choice.

2) 'conceal'
The upper window has a 'conceallevel' of 2, which means that concealed text is hidden unless a custom replacement char is specified. This has been used to render LaTeX codes thusly:
 \left( ( \right) ) \left[ [ \right] ] \cdot . \gamma Y \theta T \circ o > <

Note that \label{eqn:tlin1} in the lower window has been rendered as just eqn:tlin1 in the upper. This is made simple by the new "concealends" flag for regions which causes just the matching endgroups to be hidden. "concealends" has also been used for the inline math ($...$) regions which cleans up the upper window considerably.

3) :ownsyntax
In the upper window, which is obviously a sort of "print preview" ;) I needed a slightly different syntax scheme. Firstly the maths is not highlighted in a separate colour, and secondly the matching of "" had to be changed to make the
character replacement work as desired.

Therefore, a hacked tex.vim, named tex2.vim, was loaded into the upper window with :ownsyntax tex2
The two windows, although on the same file, now have independent syntax highlighting. On Vim 7, they can have different "spellang" settings as well. Combining independent spell languages with "cursorbind" can be useful for bilingual documents.