aboutsummaryrefslogtreecommitdiffhomepage
path: root/editors/vim/syntax/bruijn.vim
blob: 4f20593b893e3f6f4cabf1c956892ccb0cbe48f6 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
" Vim syntax file
" Language: Bruijn

if exists("b:current_syntax")
  finish
endif

syn match bruijnApplication /[()]/
syn match bruijnAbstraction /[[\]]/
syn match bruijnIndex /\([^0-9A-Za-z]\)\@<=\d\([^0-9]\)\@=/
syn match bruijnChar /'\@<=.'\@=/
syn match bruijnNumber /([+-]\d\+[dubt]\?)/
syn match bruijnFloat /([+-]\d\+\.\d\+[qr]\?)/
syn match bruijnComplex /([+-]\d\+\.\d\+[+-]\d\+\.\d\+i)/
syn match bruijnDefinition /^\t*\S\+/
syn match bruijnType /\( ⧗ \)\@<=.*$/
syn match bruijnTypeDelim / ⧗ /
syn match bruijnKeyword /:test\|:import\|:input/
syn match bruijnNamespace /[A-Z][a-z]*\(\.\)\@=/
syn match bruijnNamespaceDelim /\([A-Z][a-z]*\)\@<=\./

syn region bruijnCommentLine start="^# " end="$" oneline
syn region bruijnString start=+"+ end=+"+ oneline

hi def link bruijnIndex Special
hi def link bruijnNumber Number
hi def link bruijnFloat Number
hi def link bruijnComplex Number
hi def link bruijnString String
hi def link bruijnChar String
hi def link bruijnDefinition Define
hi def link bruijnType Structure
hi def link bruijnTypeDelim Define
hi def link bruijnKeyword Macro
hi def link bruijnNamespace Type
hi def link bruijnNamespaceDelim Special
hi def link bruijnAbstraction Function
hi def link bruijnApplication Statement
hi def link bruijnCommentLine Comment

" complete using space or C-]
abbreviate <buffer> :: ⧗
abbreviate <buffer> > ‣
abbreviate <buffer> <> ∅
abbreviate <buffer> ? …
abbreviate <buffer> && ⋀
abbreviate <buffer> \|\| ⋁
abbreviate <buffer> sum ∑
abbreviate <buffer> prod ∏
abbreviate <buffer> rprod ∐
abbreviate <buffer> infty ∞
abbreviate <buffer> . ∘
abbreviate <buffer> * ⋅
abbreviate <buffer> ** ⋆
abbreviate <buffer> => ⇒
abbreviate <buffer> <=> ⇔
abbreviate <buffer> -> →
abbreviate <buffer> <-> ↔
abbreviate <buffer> -^ ↑
abbreviate <buffer> bra ⟨
abbreviate <buffer> ket ⟩
abbreviate <buffer> bbra ⟪
abbreviate <buffer> kket ⟫
abbreviate <buffer> <=? ≤
abbreviate <buffer> >=? ≥
abbreviate <buffer> /= ≠
abbreviate <buffer> ~= ≈
abbreviate <buffer> ! ¬
abbreviate <buffer> _0 ₀
abbreviate <buffer> _1 ₁
abbreviate <buffer> _2 ₂
abbreviate <buffer> _3 ₃
abbreviate <buffer> _4 ₄
abbreviate <buffer> _5 ₅
abbreviate <buffer> _6 ₆
abbreviate <buffer> _7 ₇
abbreviate <buffer> _8 ₈
abbreviate <buffer> _9 ₉
abbreviate <buffer> _+ ₊
abbreviate <buffer> _- ₋
abbreviate <buffer> _= ₌
abbreviate <buffer> _( ₍
abbreviate <buffer> _) ₎
abbreviate <buffer> ^0 ⁰
abbreviate <buffer> ^1 ¹
abbreviate <buffer> ^2 ²
abbreviate <buffer> ^3 ³
abbreviate <buffer> ^4 ⁴
abbreviate <buffer> ^5 ⁵
abbreviate <buffer> ^6 ⁶
abbreviate <buffer> ^7 ⁷
abbreviate <buffer> ^8 ⁸
abbreviate <buffer> ^9 ⁹
abbreviate <buffer> ^+ ⁺
abbreviate <buffer> ^- ⁻
abbreviate <buffer> ^= ⁼
abbreviate <buffer> ^( ⁽
abbreviate <buffer> ^) ⁾

" === Greek letters === 
abbreviate <buffer> Alpha Α
abbreviate <buffer> alpha α
abbreviate <buffer> Beta Β
abbreviate <buffer> beta β
abbreviate <buffer> Gamma Γ
abbreviate <buffer> gamma γ
abbreviate <buffer> Delta Δ
abbreviate <buffer> delta δ
abbreviate <buffer> Epsilon Ε
abbreviate <buffer> epsilon ε
abbreviate <buffer> varepsilon ϵ
abbreviate <buffer> Zeta Ζ
abbreviate <buffer> zeta ζ
abbreviate <buffer> Eta Η
abbreviate <buffer> eta η
abbreviate <buffer> Theta Θ
abbreviate <buffer> theta θ
abbreviate <buffer> Iota Ι
abbreviate <buffer> iota ι
abbreviate <buffer> Kappa Κ
abbreviate <buffer> kappa κ
abbreviate <buffer> Lambda Λ
abbreviate <buffer> lambda λ
abbreviate <buffer> Mu Μ
abbreviate <buffer> mu μ
abbreviate <buffer> Nu Ν
abbreviate <buffer> nu ν
abbreviate <buffer> Xi Ξ
abbreviate <buffer> xi ξ
abbreviate <buffer> Omicron Ο
abbreviate <buffer> omicron ο
abbreviate <buffer> Pi Π
abbreviate <buffer> pi π
abbreviate <buffer> Rho Ρ
abbreviate <buffer> rho ρ
abbreviate <buffer> Sigma Σ
abbreviate <buffer> sigma σ
abbreviate <buffer> Tau Τ
abbreviate <buffer> tau τ
abbreviate <buffer> Upsilon Υ
abbreviate <buffer> upsilon υ
abbreviate <buffer> Phi Φ
abbreviate <buffer> phi φ
abbreviate <buffer> varphi ϕ
abbreviate <buffer> Chi Χ
abbreviate <buffer> chi χ
abbreviate <buffer> Psi Ψ
abbreviate <buffer> psi ψ
abbreviate <buffer> Omega Ω
abbreviate <buffer> omega ω

" let b:current_syntax = "bruijn"
" let &cpo = s:cpo_save
" unlet! s:cpo_save