Skip to content

Commit 05d6f93

Browse files
skanevguns
authored andcommitted
Allow for the syntax to be included in another
It is hard to include the Clojure syntax in another (for example, code blocks in Markdown) because some regions use contains=TOP, which does not work if there are other syntax rules. Putting all top-level elements in a cluster solves the problem. [Committer's notes] This is a partial merge of guns/vim-clojure-static#41
1 parent 9355ec0 commit 05d6f93

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

syntax/clojure.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ syntax keyword clojureCommentTodo contained FIXME XXX TODO FIXME: XXX: TODO:
121121
syntax match clojureComment ";.*$" contains=clojureCommentTodo,@Spell
122122
syntax match clojureComment "#!.*$"
123123

124-
syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=TOP,@Spell fold
125-
syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=TOP,@Spell fold
126-
syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=TOP,@Spell fold
124+
syntax cluster clojureTop contains=clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVarArg,clojureVariable,clojureVector
125+
126+
syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=@clojureTop fold
127+
syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=@clojureTop fold
128+
syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=@clojureTop fold
127129

128130
" Highlight superfluous closing parens, brackets and braces.
129131
syntax match clojureError "]\|}\|)"

0 commit comments

Comments
 (0)