--- /dev/null
+The MIT License (MIT)
+
+Copyright (c) 2020 Charles McGarvey
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+" Vim syntax file for Mermaid diagrams
+" Language: Mermaid
+" Maintainer: Charles McGarvey
+" Version: 0.1
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" sequenceDiagram
+syntax keyword mmdDiagramType sequenceDiagram
+
+" -> --> ->> -->> -X --X
+syntax match mmdArrow /\v(--\>\>|--\>|-\>\>|--X|-\>|-X)/
+ \ nextgroup=mmdActivationSymbol,mmdActorBeforeMessage skipwhite contained
+
+syntax match mmdInvalidActorChar /[-:;,]/ contained
+
+syntax match mmdActorBeforeArrow /\v\S.{-}\ze\s*(-\>|--\>|-\>\>|--\>\>|-X|--X)/
+ \ contains=mmdInvalidActorChar nextgroup=mmdArrow skipwhite
+syntax match mmdActorBeforeMessage /\v([^\t :][^:]*)=[^\t :]/
+ \ contains=mmdInvalidActorChar nextgroup=mmdMessageDelimiter skipwhite contained
+syntax match mmdActorBeforeComma /\v\S.{-}\ze\s*,/
+ \ contains=mmdInvalidActorChar nextgroup=mmdComma,mmdActorBeforeMessage skipwhite contained
+
+" ,
+syntax match mmdComma /\v,/ nextgroup=mmdActorBeforeMessage skipwhite contained
+
+" +|-
+syntax match mmdActivationSymbol /\v[-\+]/ contained nextgroup=mmdActorBeforeMessage skipwhite
+
+" participant <ACTOR> [as <TEXT>]
+" activate <ACTOR>
+" deactivate <ACTOR>
+syntax match mmdActor /\v\S.*/ contained contains=mmdInvalidActorChar
+syntax match mmdActor /\v\c\S.{-}\ze\s+as\s/ nextgroup=mmdAlias skipwhite contained contains=mmdInvalidActorChar
+syntax match mmdParticipant /^\v\c\s*\zsparticipant\ze\s/ nextgroup=mmdActor skipwhite
+syntax match mmdAlias /\v\cas\ze\s/ nextgroup=mmdMessage skipwhite contained
+syntax match mmdActivation /^\v\c\s*\zs(activate|deactivate)\s+/ nextgroup=mmdActor skipwhite
+
+" loop [<TEXT>]
+" alt [<TEXT>]
+" else [<TEXT>]
+" opt [<TEXT>]
+" rect [<COLOR>]
+" end
+syntax match mmdGroup /^\v\c\s*\zs(alt|else|loop|opt)/ nextgroup=mmdMessage skipwhite
+syntax match mmdGroup /^\v\c\s*\zsrect/ nextgroup=mmdColor skipwhite
+syntax match mmdGroup /^\v\c\s*\zsend/
+syntax match mmdColor /\v\S.*/ contained
+
+" autonumber
+syntax match mmdAutonumber /^\v\c\s*\zsautonumber/
+
+" Note left|right of <ACTOR>: <TEXT>
+" Note over <ACTOR>[,<ACTOR>]: <TEXT>
+syntax match mmdMessageDelimiter /\v:/ contained nextgroup=mmdMessage skipwhite
+syntax match mmdMessage /\v\S.*/ contained
+syntax match mmdNote /^\v\c\s*Note\s+(right of|left of)\ze\s/ nextgroup=mmdActorBeforeMessage skipwhite
+syntax match mmdNote /^\v\c\s*Note\s+over\ze\s/ nextgroup=mmdActorBeforeComma,mmdActorBeforeMessage skipwhite
+
+" %% <TEXT>
+syntax keyword mmdTodo contained FIXME TODO XXX
+syntax match mmdComment /\v\%\%.*$/ contains=mmdTodo
+
+highlight link mmdInvalidActorChar Error
+highlight link mmdDiagramType Function
+highlight link mmdArrow Operator
+highlight link mmdComma Operator
+highlight link mmdActivationSymbol Keyword
+highlight link mmdParticipant Keyword
+highlight link mmdActivation Keyword
+highlight link mmdAlias Keyword
+highlight link mmdTodo Todo
+highlight link mmdComment Comment
+highlight link mmdActor Identifier
+highlight link mmdActorBeforeArrow Identifier
+highlight link mmdActorBeforeMessage Identifier
+highlight link mmdActorBeforeComma Identifier
+highlight link mmdMessageDelimiter Delimiter
+highlight link mmdMessage String
+highlight link mmdNote Keyword
+highlight link mmdGroup Statement
+highlight link mmdAutonumber Statement
+highlight link mmdColor Constant
+
+let b:current_syntax = 'mermaid'
--- /dev/null
+%% This diagram file doesn't compile but can be used to manually test
+%% highlighting.
+sequenceDiagram
+ participant this wasdf sadf as as Alice in chains
+ participant John,asdf
+ Alice->> + John: Hello John, how are you? %% asdfaf
+ Alice ->> +John: John, can you hear me?
+ Alice ->> John : John, can you hear me?
+ activate John!!!
+ Jo;n-->> - This is a test : Hi Alice, I can hear you!
+ John-->> + Z : Hi Alice, I can hear you!
+ %% whatever
+ activate Foo
+ loop This is just a test
+ John-->>-Alice: I feel great!
+ end
+ Loop F
+ John-->>-Alice: I feel great!
+ END
+ alt whatever
+ else
+ end
+ opt asfef
+ foo -> bar : nice
+ end
+ rect brown
+ TODO asdf as
+ Note left of Alice: whatever
+ Note right of asdf : asdfwe
+ Note over foo,Bar : asdfwe
+ Alice -X +Bob : Hello world!!!!!!!!!1
+ %% TODO This is a comment FIXME