orchid.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
" Don't clobber existing syntax if exists("b:current_syntax") finish endif " This is just a convention, but highlighting is more useful if we consider " `Uppercase` identifiers to be types and `lowercase` identifiers to be values syntax match OrchidIdentifier "_*\l\w*" syntax match OrchidType "_*\u\w*" " We find out if something is a qualified identifier by matching an identifier " followed by a delimiter, and then rewind the match to not include the " delimiter syntax match OrchidQualifiedIdentifier "\w\w*\ze::" syntax match OrchidQualificationDelimiter "::" " Import targets have a couple of special symbols syntax region OrchidImportList start="\[" end="\]" contains=OrchidIdentifier,OrchidType,OrchidKeyword " Keywords all have a terminating `!` sigil syntax match OrchidKeyword "[A-Za-z]\w*!" " Numbers are an optional sign, an integer part, an optional fractional part, " and an optional exponent syntax match OrchidNumber "[+-]\?\d\d*\(\.\d\d*\)\?\([Ee][+-]\?\d\d*\)\?" " Strings are just a single-line region bounded by quotation marks syntax region OrchidString start=+"+ end=+"+ skip=+\\"+ oneline " Comments start with two hyphens and go to the end of the line syntax region OrchidComment start="--" end="$" oneline " Link our custom groups to the real ones that color schemes look for highlight link OrchidIdentifier Identifier highlight link OrchidType Type highlight link OrchidQualifiedIdentifier Include highlight link OrchidQualificationDelimiter Delimiter highlight link OrchidKeyword Keyword highlight link OrchidNumber Number highlight link OrchidString String highlight link OrchidComment Comment " Establish ourself as the current syntax highlighter let b:current_syntax = "orchid"