blob: afdbcc3d62089800dd24fbe9660a69aa95c6f35e [file] [log] [blame]
Bram Moolenaarb59ae592022-11-23 23:46:31 +00001" Vim syntax file
2" Language: Mermaid
3" Maintainer: Craig MacEahern <https://github.com/craigmac/vim-mermaid>
4" Filenames: *.mmd
5" Last Change: 2022 Nov 22
6
7if exists("b:current_syntax")
8 finish
9endif
10
11let s:cpo_save = &cpo
12set cpo&vim
13
14syntax iskeyword @,48-57,192-255,$,_,-,:
15syntax keyword mermaidKeyword
16 \ _blank
17 \ _self
18 \ _parent
19 \ _top
20 \ ::icon
21 \ accDescr
22 \ accTitle
23 \ actor
24 \ activate
25 \ alt
26 \ and
27 \ as
28 \ autonumber
29 \ branch
30 \ break
31 \ callback
32 \ checkout
33 \ class
34 \ classDef
35 \ classDiagram
36 \ click
37 \ commit
38 \ commitgitGraph
39 \ critical
40 \ dataFormat
41 \ dateFormat
42 \ deactivate
43 \ direction
44 \ element
45 \ else
46 \ end
47 \ erDiagram
48 \ flowchart
49 \ gantt
50 \ gitGraph
51 \ graph
52 \ journey
53 \ link
54 \ LR
55 \ TD
56 \ TB
57 \ RL
58 \ loop
59 \ merge
60 \ mindmap root
61 \ Note
62 \ Note right of
63 \ Note left of
64 \ Note over
65 \ note
66 \ note right of
67 \ note left of
68 \ note over
69 \ opt
70 \ option
71 \ par
72 \ participant
73 \ pie
74 \ rect
75 \ requirement
76 \ rgb
77 \ section
78 \ sequenceDiagram
79 \ state
80 \ stateDiagram
81 \ stateDiagram-v2
82 \ style
83 \ subgraph
84 \ title
85highlight link mermaidKeyword Keyword
86
87syntax match mermaidStatement "|"
88syntax match mermaidStatement "--\?[>x)]>\?+\?-\?"
89syntax match mermaidStatement "\~\~\~"
90syntax match mermaidStatement "--"
91syntax match mermaidStatement "---"
92syntax match mermaidStatement "-->"
93syntax match mermaidStatement "-\."
94syntax match mermaidStatement "\.->"
95syntax match mermaidStatement "-\.-"
96syntax match mermaidStatement "-\.\.-"
97syntax match mermaidStatement "-\.\.\.-"
98syntax match mermaidStatement "=="
99syntax match mermaidStatement "==>"
100syntax match mermaidStatement "===>"
101syntax match mermaidStatement "====>"
102syntax match mermaidStatement "&"
103syntax match mermaidStatement "--o"
104syntax match mermaidStatement "--x"
105syntax match mermaidStatement "x--x"
106syntax match mermaidStatement "-----"
107syntax match mermaidStatement "---->"
108syntax match mermaidStatement "==="
109syntax match mermaidStatement "===="
110syntax match mermaidStatement "====="
111syntax match mermaidStatement ":::"
112syntax match mermaidStatement "<|--"
113syntax match mermaidStatement "\*--"
114syntax match mermaidStatement "o--"
115syntax match mermaidStatement "o--o"
116syntax match mermaidStatement "<--"
117syntax match mermaidStatement "<-->"
118syntax match mermaidStatement "\.\."
119syntax match mermaidStatement "<\.\."
120syntax match mermaidStatement "<|\.\."
121syntax match mermaidStatement "--|>"
122syntax match mermaidStatement "--\*"
123syntax match mermaidStatement "--o"
124syntax match mermaidStatement "\.\.>"
125syntax match mermaidStatement "\.\.|>"
126syntax match mermaidStatement "<|--|>"
127syntax match mermaidStatement "||--o{"
128highlight link mermaidStatement Statement
129
130syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?"
131highlight link mermaidIdentifier Identifier
132
133syntax match mermaidType "[\+-\#\~]\?\cint\>"
134syntax match mermaidType "[\+-\#\~]\?\cString\>"
135syntax match mermaidType "[\+-\#\~]\?\cbool\>"
136syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>"
137syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~"
138syntax match mermaidType "<<\w\+>>"
139highlight link mermaidType Type
140
141syntax match mermaidComment "%%.*$"
142highlight link mermaidComment Comment
143
144syntax region mermaidDirective start="%%{" end="\}%%"
145highlight link mermaidDirective PreProc
146
147syntax region mermaidString start=/"/ skip=/\\"/ end=/"/
148highlight link mermaidString String
149
150let b:current_syntax = "mermaid"
151
152let &cpo = s:cpo_save
153unlet s:cpo_save
154
155" vim:set sw=2: