robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:bbf4a10: runtime(unison): update syntax from upstream repository4a2b9ec3c7

master
5.7 KiB105 linesraw
1" Vim syntax file
2"
3" Language:        unison
4" Maintainer:      Anton Parkhomenko <anton@chuwy.me>
5" Last Change:     Oct 25, 2025
6" Original Author: John Williams, Paul Chiusano and Rúnar Bjarnason
7
8if exists("b:current_syntax")
9  finish
10endif
11
12syntax include @markdown $VIMRUNTIME/syntax/markdown.vim
13
14syn cluster markdownLikeDocs contains=markdownBold,markdownItalic,markdownLinkText,markdownListMarker,markdownOrderedListMarker,markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6
15
16syn match unisonOperator "[-!#$%&\*\+/<=>\?@\\^|~]"
17syn match unisonDelimiter "[\[\](){},.]"
18
19" Strings and constants
20syn match   unisonSpecialChar	contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
21syn match   unisonSpecialChar	contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"
22syn match   unisonSpecialCharError	contained "\\&\|'''\+"
23syn region  unisonString		start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=unisonSpecialChar
24syn match   unisonCharacter		"[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=unisonSpecialChar,unisonSpecialCharError
25syn match   unisonCharacter		"^'\([^\\]\|\\[^']\+\|\\'\)'" contains=unisonSpecialChar,unisonSpecialCharError
26syn match   unisonNumber		"\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>\|\<0[bB][01]\+\>"
27syn match   unisonFloat		"\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
28
29" Keyword definitions. These must be patterns instead of keywords
30" because otherwise they would match as keywords at the start of a
31" "literate" comment (see lu.vim).
32syn match unisonModule		"\<namespace\>"
33syn match unisonImport		"\<use\>"
34syn match unisonTypedef		"\<\(unique\|structural\|∀\|forall\)\>"
35syn match unisonStatement		"\<\(ability\|do\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>"
36syn match unisonConditional		"\<\(if\|else\|then\)\>"
37
38syn match unisonBoolean "\<\(true\|false\)\>"
39
40syn match unisonType "\<\C[A-Z][0-9A-Za-z_'!]*\>"
41syn match unisonName "\<\C[a-z_][0-9A-Za-z_'!]*\>" contains=ALL
42syn match unisonDef "^\C[A-Za-z_][0-9A-Za-z_'!]*:"
43
44" Comments
45syn match   unisonLineComment      "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
46syn region  unisonBlockComment     start="{-"  end="-}" contains=unisonBlockComment
47syn region  unisonBelowFold	   start="^---" skip="." end="." contains=unisonBelowFold
48
49" Docs
50syn region  unisonDocBlock         matchgroup=unisonDoc start="{{" end="}}" contains=unisonDocTypecheck,unisonDocQuasiquote,unisonDocDirective,unisonDocCode,unisonDocCodeInline,unisonDocCodeRaw,unisonDocMono,@markdownLikeDocs
51syn region  unisonDocQuasiquote    contained matchgroup=unisonDocQuote start="{{" end= "}}" contains=TOP
52syn region  unisonDocCode          contained matchgroup=unisonDocCode start="^\s*```\s*$" end="^\s*```\s*$" contains=TOP
53syn region  unisonDocTypecheck     contained matchgroup=unisonDocCode start="^\s*@typecheck\s*```\s*$" end="^\s*```\s*$" contains=TOP
54syn region  unisonDocCodeRaw       contained matchgroup=unisonDocCode start="^\s*```\s*raw\s*$" end="^\s*```\s*$" contains=NoSyntax
55syn region  unisonDocCodeInline    contained matchgroup=unisonDocCode start="`\@<!``" end="`\@<!``" contains=TOP
56syn match   unisonDocMono          "''[^']*''"
57syn region  unisonDocDirective     contained matchgroup=unisonDocDirective start="\(@\([a-zA-Z0-9_']*\)\)\?{{\@!" end="}" contains=TOP
58
59syn match unisonDebug "\<\(todo\|bug\|Debug.trace\|Debug.evalToText\)\>"
60
61" things like
62"    > my_func 1 3
63"    test> Function.tap.tests.t1 = check let
64"      use Nat == +
65"      ( 99, 100 ) === (withInitialValue 0 do
66"          :      :      :
67syn match unisonWatch "^[A-Za-z]*>"
68
69hi def link       unisonWatch                           Debug
70hi def link       unisonDocMono                         Delimiter
71hi def link       unisonDocDirective                    Import
72hi def link       unisonDocQuote                        Delimiter
73hi def link       unisonDocCode                         Delimiter
74hi def link       unisonDoc                             String
75hi def link       unisonBelowFold                       Comment
76hi def link       unisonBlockComment                    Comment
77hi def link       unisonBoolean                         Boolean
78hi def link       unisonCharacter                       Character
79hi def link       unisonComment                         Comment
80hi def link       unisonConditional                     Conditional
81hi def link       unisonConditional                     Conditional
82hi def link       unisonDebug                           Debug
83hi def link       unisonDelimiter                       Delimiter
84hi def link       unisonDocBlock                        String
85hi def link       unisonDocDirective                    Import
86hi def link       unisonDocIncluded                     Import
87hi def link       unisonFloat                           Float
88hi def link       unisonImport                          Include
89hi def link       unisonLineComment                     Comment
90hi def link       unisonLink                            Type
91hi def link       unisonName                            Identifier
92hi def link       unisonDef                             Typedef
93hi def link       unisonNumber                          Number
94hi def link       unisonOperator                        Operator
95hi def link       unisonSpecialChar                     SpecialChar
96hi def link       unisonSpecialCharError                Error
97hi def link       unisonStatement                       Statement
98hi def link       unisonString                          String
99hi def link       unisonType                            Type
100hi def link       unisonTypedef                         Typedef
101
102
103let b:current_syntax = "unison"
104
105" Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim