-
Notifications
You must be signed in to change notification settings - Fork 1
/
jared.vim
510 lines (470 loc) · 15.2 KB
/
jared.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
set background=dark
" set cursorline highlighting
augroup toggle_cursorline_color
autocmd!
autocmd InsertEnter * set cursorline
" Reset CursorLine highlighting to the defaults.
autocmd InsertLeave * set nocursorline
augroup END
" set cursor background
hi CursorLine ctermfg=NONE ctermbg=238 cterm=NONE guifg=NONE guibg=#404449 gui=NONE
" Default GUI Colours
let s:foreground = "c5c8c6"
let s:background = "1d1f21"
let s:highlightbg = "35393d"
let s:highlightfg = "ffffff"
let s:selection = "373b41"
let s:line = "282a2e"
let s:comment = "969896"
let s:red = "cc6666"
let s:orange = "de935f"
let s:yellow = "f0c674"
let s:green = "8cd48c"
let s:aqua = "8abeb7"
let s:blue = "5ca5ff"
let s:purple = "b294bb"
let s:window = "4d5057"
let s:black = "000000"
let s:linenr = "55ffff"
" Console 256 Colours
if !has("gui_running")
let s:background = "303030"
let s:window = "5e5e5e"
let s:line = "3a3a3a"
let s:selection = "585858"
end
hi clear
syntax reset
let g:colors_name = "Tomorrow-Night"
if has("gui_running") || &t_Co == 88 || &t_Co == 256
" Returns an approximate grey index for the given grey level
fun <SID>grey_number(x)
if &t_Co == 88
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
elseif a:x < 127
return 3
elseif a:x < 150
return 4
elseif a:x < 173
return 5
elseif a:x < 196
return 6
elseif a:x < 219
return 7
elseif a:x < 243
return 8
else
return 9
endif
else
if a:x < 14
return 0
else
let l:n = (a:x - 8) / 10
let l:m = (a:x - 8) % 10
if l:m < 5
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" Returns the actual grey level represented by the grey index
fun <SID>grey_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 46
elseif a:n == 2
return 92
elseif a:n == 3
return 115
elseif a:n == 4
return 139
elseif a:n == 5
return 162
elseif a:n == 6
return 185
elseif a:n == 7
return 208
elseif a:n == 8
return 231
else
return 255
endif
else
if a:n == 0
return 0
else
return 8 + (a:n * 10)
endif
endif
endfun
" Returns the palette index for the given grey index
fun <SID>grey_colour(n)
if &t_Co == 88
if a:n == 0
return 16
elseif a:n == 9
return 79
else
return 79 + a:n
endif
else
if a:n == 0
return 16
elseif a:n == 25
return 231
else
return 231 + a:n
endif
endif
endfun
" Returns an approximate colour index for the given colour level
fun <SID>rgb_number(x)
if &t_Co == 88
if a:x < 69
return 0
elseif a:x < 172
return 1
elseif a:x < 230
return 2
else
return 3
endif
else
if a:x < 75
return 0
else
let l:n = (a:x - 55) / 40
let l:m = (a:x - 55) % 40
if l:m < 20
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" Returns the actual colour level for the given colour index
fun <SID>rgb_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 139
elseif a:n == 2
return 205
else
return 255
endif
else
if a:n == 0
return 0
else
return 55 + (a:n * 40)
endif
endif
endfun
" Returns the palette index for the given R/G/B colour indices
fun <SID>rgb_colour(x, y, z)
if &t_Co == 88
return 16 + (a:x * 16) + (a:y * 4) + a:z
else
return 16 + (a:x * 36) + (a:y * 6) + a:z
endif
endfun
" Returns the palette index to approximate the given R/G/B colour levels
fun <SID>colour(r, g, b)
" Get the closest grey
let l:gx = <SID>grey_number(a:r)
let l:gy = <SID>grey_number(a:g)
let l:gz = <SID>grey_number(a:b)
" Get the closest colour
let l:x = <SID>rgb_number(a:r)
let l:y = <SID>rgb_number(a:g)
let l:z = <SID>rgb_number(a:b)
if l:gx == l:gy && l:gy == l:gz
" There are two possibilities
let l:dgr = <SID>grey_level(l:gx) - a:r
let l:dgg = <SID>grey_level(l:gy) - a:g
let l:dgb = <SID>grey_level(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = <SID>rgb_level(l:gx) - a:r
let l:dg = <SID>rgb_level(l:gy) - a:g
let l:db = <SID>rgb_level(l:gz) - a:b
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
if l:dgrey < l:drgb
" Use the grey
return <SID>grey_colour(l:gx)
else
" Use the colour
return <SID>rgb_colour(l:x, l:y, l:z)
endif
else
" Only one possibility
return <SID>rgb_colour(l:x, l:y, l:z)
endif
endfun
" Returns the palette index to approximate the 'rrggbb' hex string
fun <SID>rgb(rgb)
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return <SID>colour(l:r, l:g, l:b)
endfun
" Sets the highlighting for the given group
fun <SID>X(group, fg, bg, attr)
if a:fg != ""
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
endif
if a:bg != ""
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
endif
if a:attr != ""
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
endif
endfun
" Vim Highlighting
call <SID>X("Normal", s:foreground, s:background, "")
call <SID>X("LineNr", s:linenr, "", "")
call <SID>X("NonText", s:selection, "", "")
call <SID>X("SpecialKey", s:selection, "", "")
call <SID>X("Search", s:background, s:yellow, "")
call <SID>X("TabLine", s:window, s:foreground, "reverse")
call <SID>X("TabLineFill", s:window, s:foreground, "reverse")
call <SID>X("StatusLine", s:window, s:yellow, "reverse")
call <SID>X("StatusLineNC", s:window, s:foreground, "reverse")
call <SID>X("VertSplit", s:window, s:window, "none")
call <SID>X("Visual", "", s:black, "reverse")
call <SID>X("Directory", s:blue, "", "")
call <SID>X("ModeMsg", s:green, "", "")
call <SID>X("MoreMsg", s:green, "", "")
call <SID>X("Question", s:green, "", "")
call <SID>X("WarningMsg", s:red, "", "")
call <SID>X("MatchParen", "", s:selection, "")
call <SID>X("Folded", s:comment, s:background, "")
call <SID>X("FoldColumn", "", s:background, "")
if version >= 700
call <SID>X("CursorLine", "", s:line, "none")
call <SID>X("CursorColumn", "", s:line, "none")
call <SID>X("PMenu", s:foreground, s:selection, "none")
call <SID>X("PMenuSel", s:foreground, s:selection, "reverse")
call <SID>X("SignColumn", "", s:background, "none")
end
if version >= 703
call <SID>X("ColorColumn", "", s:line, "none")
end
" Standard Highlighting
call <SID>X("Comment", s:comment, s:highlightbg, "")
call <SID>X("Todo", s:highlightfg, s:highlightbg, "")
call <SID>X("Title", s:comment, "", "")
call <SID>X("Identifier", s:red, "", "none")
call <SID>X("Statement", s:foreground, "", "")
call <SID>X("Conditional", s:foreground, "", "")
call <SID>X("Repeat", s:foreground, "", "")
call <SID>X("Structure", s:purple, "", "")
call <SID>X("Function", s:blue, "", "")
call <SID>X("Constant", s:orange, "", "")
call <SID>X("Keyword", s:orange, "", "")
call <SID>X("String", s:green, "", "")
call <SID>X("Special", s:foreground, "", "")
call <SID>X("PreProc", s:purple, "", "")
call <SID>X("Operator", s:aqua, "", "none")
call <SID>X("Type", s:blue, "", "none")
call <SID>X("Define", s:purple, "", "none")
call <SID>X("Include", s:blue, "", "")
"call <SID>X("Ignore", "666666", "", "")
" Vim Highlighting
call <SID>X("vimCommand", s:red, "", "none")
" C Highlighting
call <SID>X("cType", s:yellow, "", "")
call <SID>X("cStorageClass", s:purple, "", "")
call <SID>X("cConditional", s:purple, "", "")
call <SID>X("cRepeat", s:purple, "", "")
" PHP Highlighting
call <SID>X("phpVarSelector", s:red, "", "")
call <SID>X("phpKeyword", s:purple, "", "")
call <SID>X("phpRepeat", s:purple, "", "")
call <SID>X("phpConditional", s:purple, "", "")
call <SID>X("phpStatement", s:purple, "", "")
call <SID>X("phpMemberSelector", s:foreground, "", "")
" Ruby Highlighting
call <SID>X("rubySymbol", s:green, "", "")
call <SID>X("rubyConstant", s:yellow, "", "")
call <SID>X("rubyAccess", s:yellow, "", "")
call <SID>X("rubyAttribute", s:blue, "", "")
call <SID>X("rubyInclude", s:blue, "", "")
call <SID>X("rubyLocalVariableOrMethod", s:orange, "", "")
call <SID>X("rubyCurlyBlock", s:orange, "", "")
call <SID>X("rubyStringDelimiter", s:green, "", "")
call <SID>X("rubyInterpolationDelimiter", s:orange, "", "")
call <SID>X("rubyConditional", s:purple, "", "")
call <SID>X("rubyRepeat", s:purple, "", "")
call <SID>X("rubyControl", s:purple, "", "")
call <SID>X("rubyException", s:purple, "", "")
" Crystal Highlighting
call <SID>X("crystalSymbol", s:green, "", "")
call <SID>X("crystalConstant", s:yellow, "", "")
call <SID>X("crystalAccess", s:yellow, "", "")
call <SID>X("crystalAttribute", s:blue, "", "")
call <SID>X("crystalInclude", s:blue, "", "")
call <SID>X("crystalLocalVariableOrMethod", s:orange, "", "")
call <SID>X("crystalCurlyBlock", s:orange, "", "")
call <SID>X("crystalStringDelimiter", s:green, "", "")
call <SID>X("crystalInterpolationDelimiter", s:orange, "", "")
call <SID>X("crystalConditional", s:purple, "", "")
call <SID>X("crystalRepeat", s:purple, "", "")
call <SID>X("crystalControl", s:purple, "", "")
call <SID>X("crystalException", s:purple, "", "")
" Python Highlighting
call <SID>X("pythonInclude", s:purple, "", "")
call <SID>X("pythonStatement", s:purple, "", "")
call <SID>X("pythonConditional", s:purple, "", "")
call <SID>X("pythonRepeat", s:purple, "", "")
call <SID>X("pythonException", s:purple, "", "")
call <SID>X("pythonFunction", s:blue, "", "")
call <SID>X("pythonPreCondit", s:purple, "", "")
call <SID>X("pythonRepeat", s:aqua, "", "")
call <SID>X("pythonExClass", s:orange, "", "")
" JavaScript Highlighting
call <SID>X("javaScriptBraces", s:foreground, "", "")
call <SID>X("javaScriptFunction", s:purple, "", "")
call <SID>X("javaScriptConditional", s:purple, "", "")
call <SID>X("javaScriptRepeat", s:purple, "", "")
call <SID>X("javaScriptNumber", s:orange, "", "")
call <SID>X("javaScriptMember", s:orange, "", "")
call <SID>X("javascriptNull", s:orange, "", "")
call <SID>X("javascriptGlobal", s:blue, "", "")
call <SID>X("javascriptStatement", s:red, "", "")
" CoffeeScript Highlighting
call <SID>X("coffeeRepeat", s:purple, "", "")
call <SID>X("coffeeConditional", s:purple, "", "")
call <SID>X("coffeeKeyword", s:purple, "", "")
call <SID>X("coffeeObject", s:yellow, "", "")
" HTML Highlighting
call <SID>X("htmlTag", s:red, "", "")
call <SID>X("htmlTagName", s:red, "", "")
call <SID>X("htmlArg", s:red, "", "")
call <SID>X("htmlScriptTag", s:red, "", "")
" Diff Highlighting
call <SID>X("diffAdd", "", "4c4e39", "")
call <SID>X("diffDelete", s:background, s:red, "")
call <SID>X("diffChange", "", "2B5B77", "")
call <SID>X("diffText", s:line, s:blue, "")
" ShowMarks Highlighting
call <SID>X("ShowMarksHLl", s:orange, s:background, "none")
call <SID>X("ShowMarksHLo", s:purple, s:background, "none")
call <SID>X("ShowMarksHLu", s:yellow, s:background, "none")
call <SID>X("ShowMarksHLm", s:aqua, s:background, "none")
" Lua Highlighting
call <SID>X("luaStatement", s:purple, "", "")
call <SID>X("luaRepeat", s:purple, "", "")
call <SID>X("luaCondStart", s:purple, "", "")
call <SID>X("luaCondElseif", s:purple, "", "")
call <SID>X("luaCond", s:purple, "", "")
call <SID>X("luaCondEnd", s:purple, "", "")
" Cucumber Highlighting
call <SID>X("cucumberGiven", s:blue, "", "")
call <SID>X("cucumberGivenAnd", s:blue, "", "")
" Go Highlighting
call <SID>X("goDirective", s:purple, "", "")
call <SID>X("goDeclaration", s:purple, "", "")
call <SID>X("goStatement", s:purple, "", "")
call <SID>X("goConditional", s:purple, "", "")
call <SID>X("goConstants", s:orange, "", "")
call <SID>X("goTodo", s:yellow, "", "")
call <SID>X("goDeclType", s:blue, "", "")
call <SID>X("goBuiltins", s:purple, "", "")
call <SID>X("goRepeat", s:purple, "", "")
call <SID>X("goLabel", s:purple, "", "")
" Clojure Highlighting
call <SID>X("clojureConstant", s:orange, "", "")
call <SID>X("clojureBoolean", s:orange, "", "")
call <SID>X("clojureCharacter", s:orange, "", "")
call <SID>X("clojureKeyword", s:green, "", "")
call <SID>X("clojureNumber", s:orange, "", "")
call <SID>X("clojureString", s:green, "", "")
call <SID>X("clojureRegexp", s:green, "", "")
call <SID>X("clojureParen", s:aqua, "", "")
call <SID>X("clojureVariable", s:yellow, "", "")
call <SID>X("clojureCond", s:blue, "", "")
call <SID>X("clojureDefine", s:purple, "", "")
call <SID>X("clojureException", s:red, "", "")
call <SID>X("clojureFunc", s:blue, "", "")
call <SID>X("clojureMacro", s:blue, "", "")
call <SID>X("clojureRepeat", s:blue, "", "")
call <SID>X("clojureSpecial", s:purple, "", "")
call <SID>X("clojureQuote", s:blue, "", "")
call <SID>X("clojureUnquote", s:blue, "", "")
call <SID>X("clojureMeta", s:blue, "", "")
call <SID>X("clojureDeref", s:blue, "", "")
call <SID>X("clojureAnonArg", s:blue, "", "")
call <SID>X("clojureRepeat", s:blue, "", "")
call <SID>X("clojureDispatch", s:blue, "", "")
" Scala Highlighting
call <SID>X("scalaKeyword", s:purple, "", "")
call <SID>X("scalaKeywordModifier", s:purple, "", "")
call <SID>X("scalaOperator", s:blue, "", "")
call <SID>X("scalaPackage", s:red, "", "")
call <SID>X("scalaFqn", s:foreground, "", "")
call <SID>X("scalaFqnSet", s:foreground, "", "")
call <SID>X("scalaImport", s:purple, "", "")
call <SID>X("scalaBoolean", s:orange, "", "")
call <SID>X("scalaDef", s:purple, "", "")
call <SID>X("scalaVal", s:purple, "", "")
call <SID>X("scalaVar", s:aqua, "", "")
call <SID>X("scalaClass", s:purple, "", "")
call <SID>X("scalaObject", s:purple, "", "")
call <SID>X("scalaTrait", s:purple, "", "")
call <SID>X("scalaDefName", s:blue, "", "")
call <SID>X("scalaValName", s:foreground, "", "")
call <SID>X("scalaVarName", s:foreground, "", "")
call <SID>X("scalaClassName", s:foreground, "", "")
call <SID>X("scalaType", s:yellow, "", "")
call <SID>X("scalaTypeSpecializer", s:yellow, "", "")
call <SID>X("scalaAnnotation", s:orange, "", "")
call <SID>X("scalaNumber", s:orange, "", "")
call <SID>X("scalaDefSpecializer", s:yellow, "", "")
call <SID>X("scalaClassSpecializer", s:yellow, "", "")
call <SID>X("scalaBackTick", s:green, "", "")
call <SID>X("scalaRoot", s:foreground, "", "")
call <SID>X("scalaMethodCall", s:blue, "", "")
call <SID>X("scalaCaseType", s:yellow, "", "")
call <SID>X("scalaLineComment", s:comment, "", "")
call <SID>X("scalaComment", s:comment, "", "")
call <SID>X("scalaDocComment", s:comment, "", "")
call <SID>X("scalaDocTags", s:comment, "", "")
call <SID>X("scalaEmptyString", s:green, "", "")
call <SID>X("scalaMultiLineString", s:green, "", "")
call <SID>X("scalaUnicode", s:orange, "", "")
call <SID>X("scalaString", s:green, "", "")
call <SID>X("scalaStringEscape", s:green, "", "")
call <SID>X("scalaSymbol", s:orange, "", "")
call <SID>X("scalaChar", s:orange, "", "")
call <SID>X("scalaXml", s:green, "", "")
call <SID>X("scalaConstructorSpecializer", s:yellow, "", "")
call <SID>X("scalaBackTick", s:blue, "", "")
" Git
call <SID>X("diffAdded", s:green, "", "")
call <SID>X("diffRemoved", s:red, "", "")
call <SID>X("gitcommitSummary", "", "", "bold")
" Delete Functions
delf <SID>X
delf <SID>rgb
delf <SID>colour
delf <SID>rgb_colour
delf <SID>rgb_level
delf <SID>rgb_number
delf <SID>grey_colour
delf <SID>grey_level
delf <SID>grey_number
endif
set background=dark