guns/vim-clojure-static — pull request #41 by skanev (2014-02-07 11:32:16+00:00)
Title: Clojure syntax can't be used with :syntax include

Hi!

I tried embedding the Clojure syntax highlighting in another syntax, but it doesn't work. I'm doing the following (simplified for the pull request):

syntax include @Clojure syntax/clojure.vim
syntax region clojureCode start=/^```clojure$/ end=/^```$/ contains=@Clojure

As fair as I understand it, this is the standard way of doing it, but it does not highlight properly. The culprit are the following three lines:

syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=TOP,@Spell fold
syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=TOP,@Spell fold
syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=TOP,@Spell fold

Since they do `contains=TOP`, Vim attempts to match all top-level rules, not just the Clojure ones.

Aggregating them in a cluster and using it instead (as the [HTML syntax](https://code.google.com/p/vim/source/browse/runtime/syntax/html.vim#123) does) solves the problem.

Because the syntax rules depend on the `iskeyword` option, I have copied it from the ftplugin, as the Vim manual suggests ([section 44.2](https://code.google.com/p/vim/source/browse/runtime/syntax/html.vim#123), under 'UNUSUAL KEYWORDS').

I hope this makes sense :)