summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/mermaid.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:09:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:09:20 +0000
commit029f72b1a93430b24b88eb3a72c6114d9f149737 (patch)
tree765d5c2041967f9c6fef195fe343d9234a030e90 /runtime/syntax/mermaid.vim
parentInitial commit. (diff)
downloadvim-029f72b1a93430b24b88eb3a72c6114d9f149737.tar.xz
vim-029f72b1a93430b24b88eb3a72c6114d9f149737.zip
Adding upstream version 2:9.1.0016.upstream/2%9.1.0016
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/mermaid.vim')
-rw-r--r--runtime/syntax/mermaid.vim131
1 files changed, 131 insertions, 0 deletions
diff --git a/runtime/syntax/mermaid.vim b/runtime/syntax/mermaid.vim
new file mode 100644
index 0000000..5a9a217
--- /dev/null
+++ b/runtime/syntax/mermaid.vim
@@ -0,0 +1,131 @@
+" Vim syntax file
+" Language: Mermaid
+" Maintainer: Craig MacEahern <https://github.com/craigmac/vim-mermaid>
+" Filenames: *.mmd
+" Last Change: 2023 Dec 26
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syntax iskeyword @,48-57,192-255,$,_,-,:
+syntax keyword mermaidKeyword
+ \ _blank
+ \ _self
+ \ _parent
+ \ _top
+ \ ::icon
+ \ accDescr
+ \ accTitle
+ \ actor
+ \ activate
+ \ alt
+ \ and
+ \ as
+ \ autonumber
+ \ branch
+ \ break
+ \ callback
+ \ checkout
+ \ class
+ \ classDef
+ \ classDiagram
+ \ click
+ \ commit
+ \ commitgitGraph
+ \ critical
+ \ dataFormat
+ \ dateFormat
+ \ deactivate
+ \ direction
+ \ element
+ \ else
+ \ end
+ \ erDiagram
+ \ flowchart
+ \ gantt
+ \ gitGraph
+ \ graph
+ \ journey
+ \ link
+ \ LR
+ \ TD
+ \ TB
+ \ RL
+ \ loop
+ \ merge
+ \ mindmap root
+ \ Note
+ \ Note right of
+ \ Note left of
+ \ Note over
+ \ note
+ \ note right of
+ \ note left of
+ \ note over
+ \ opt
+ \ option
+ \ par
+ \ participant
+ \ pie
+ \ rect
+ \ requirement
+ \ rgb
+ \ section
+ \ sequenceDiagram
+ \ state
+ \ stateDiagram
+ \ stateDiagram-v2
+ \ style
+ \ subgraph
+ \ title
+highlight link mermaidKeyword Keyword
+
+syntax match mermaidStatement "|"
+syntax match mermaidStatement "\~\~\~"
+syntax match mermaidStatement "--"
+syntax match mermaidStatement "\%(<|\|[<*o]\)\?\%(--\|\.\.\)\%(|>\|[>*o]\)\?"
+syntax match mermaidStatement "-\{2,4}[>ox-]"
+syntax match mermaidStatement "\.-[>ox]"
+syntax match mermaidStatement "-\."
+syntax match mermaidStatement "-\.\{1,3}-"
+syntax match mermaidStatement "=="
+syntax match mermaidStatement "=\{2,4}[>ox=]"
+syntax match mermaidStatement "&"
+syntax match mermaidStatement "--\?[>x)]>\?[+-]\?"
+syntax match mermaidStatement "x--x"
+syntax match mermaidStatement "o--o\?"
+syntax match mermaidStatement "<-->\?"
+syntax match mermaidStatement ":::"
+syntax match mermaidStatement "||--o{"
+highlight link mermaidStatement Statement
+
+" FIXME: This unexpectedly matches flow chart node `id1(text)` or others.
+"syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?"
+"highlight link mermaidIdentifier Identifier
+
+syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(unsigned\s\+\)\?\%(int\|u\?int\%(8\|16\|32\|64\)_t\|char\|long\|long\s\+long\)\>\%(\s\+const\|\s*[\*&]\)*"
+syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(double\|float\|String\|bool\)\>\%(\s\+const\|\s*[\*&]\)*"
+syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>"
+syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~"
+syntax match mermaidType "<<\w\+>>"
+highlight link mermaidType Type
+
+syntax match mermaidComment "%%.*$"
+highlight link mermaidComment Comment
+
+syntax region mermaidDirective start="%%{" end="\}%%"
+highlight link mermaidDirective PreProc
+
+syntax region mermaidString start=/"/ skip=/\\"/ end=/"/
+highlight link mermaidString String
+
+let b:current_syntax = "mermaid"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2: