Wed, 25 Sep 2024 15:03:13 -0500
No LSP autostart when read-only
I think nvim actually threw out 'view' argc detection, I just use -R and alias
view to it.
1 | 1 | " Vim color file |
2 | " | |
3 | " " __ _ _ _ " | |
4 | " " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ " | |
5 | " " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| " | |
6 | " " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ " | |
7 | " " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ " | |
8 | " " \___/ " | |
9 | " | |
10 | " "A colorful, dark color scheme for Vim." | |
11 | " | |
12 | " File: jellybeans.vim | |
13 | " URL: github.com/nanotech/jellybeans.vim | |
14 | " Scripts URL: vim.org/scripts/script.php?script_id=2555 | |
15 | " Maintainer: NanoTech (nanotech.nanotechcorp.net) | |
863 | 16 | " Version: 1.7 |
17 | " Last Change: June 21st, 2019 | |
1 | 18 | " License: MIT |
863 | 19 | " Contributors: Andrew Wong (w0ng) |
20 | " Benjamin R. Haskell (benizi) | |
21 | " Brian Marshall (bmars) | |
22 | " Daniel Herbert (pocketninja) | |
23 | " David Liang <bmdavll at gmail dot com> | |
24 | " Filipe Silva (ninrod) | |
1 | 25 | " Henry So, Jr. <henryso@panix.com> |
863 | 26 | " Ihor Kalnytskyi (ikalnytskyi) |
27 | " Joe Doherty (docapotamus) | |
28 | " Karl Litterfeldt (Litterfeldt) | |
29 | " Keith Pitt (keithpitt) | |
30 | " Mike Schreifels (schreifels) | |
31 | " Philipp Rustemeier (12foo) | |
32 | " Rafael Bicalho (rbika) | |
1 | 33 | " Rich Healey (richo) |
863 | 34 | " Siwen Yu (yusiwen) |
35 | " Tim Willis (willist) | |
36 | " Tom McLaughlin (tmcoma) | |
1 | 37 | " |
863 | 38 | " Copyright (c) 2009-2019 NanoTech |
1 | 39 | " |
40 | " Permission is hereby granted, free of charge, to any per‐ | |
41 | " son obtaining a copy of this software and associated doc‐ | |
42 | " umentation files (the “Software”), to deal in the Soft‐ | |
43 | " ware without restriction, including without limitation | |
44 | " the rights to use, copy, modify, merge, publish, distrib‐ | |
45 | " ute, sublicense, and/or sell copies of the Software, and | |
46 | " to permit persons to whom the Software is furnished to do | |
47 | " so, subject to the following conditions: | |
48 | " | |
49 | " The above copyright notice and this permission notice | |
50 | " shall be included in all copies or substantial portions | |
51 | " of the Software. | |
52 | " | |
53 | " THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY | |
54 | " KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | |
55 | " THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐ | |
56 | " LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
57 | " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
58 | " DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐ | |
59 | " TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ | |
60 | " NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
61 | " THE SOFTWARE. | |
62 | ||
63 | set background=dark | |
64 | ||
65 | hi clear | |
66 | ||
67 | if exists("syntax_on") | |
68 | syntax reset | |
69 | endif | |
70 | ||
71 | let colors_name = "jellybeans" | |
72 | ||
863 | 73 | if has("gui_running") || (has('termguicolors') && &termguicolors) |
74 | let s:true_color = 1 | |
75 | else | |
76 | let s:true_color = 0 | |
77 | endif | |
78 | ||
79 | if s:true_color || &t_Co >= 88 | |
1 | 80 | let s:low_color = 0 |
81 | else | |
82 | let s:low_color = 1 | |
83 | endif | |
84 | ||
863 | 85 | " Configuration Variables: |
86 | " - g:jellybeans_overrides (default = {}) | |
87 | " - g:jellybeans_use_lowcolor_black (default = 0) | |
88 | " - g:jellybeans_use_gui_italics (default = 1) | |
89 | " - g:jellybeans_use_term_italics (default = 0) | |
90 | ||
91 | let s:background_color = "151515" | |
92 | ||
93 | if exists("g:jellybeans_overrides") | |
94 | let s:overrides = g:jellybeans_overrides | |
95 | else | |
96 | let s:overrides = {} | |
97 | endif | |
98 | ||
99 | " Backwards compatibility | |
100 | if exists("g:jellybeans_background_color") | |
101 | \ || exists("g:jellybeans_background_color_256") | |
102 | \ || exists("g:jellybeans_use_term_background_color") | |
103 | ||
104 | let s:overrides = deepcopy(s:overrides) | |
105 | ||
106 | if !has_key(s:overrides, "background") | |
107 | let s:overrides["background"] = {} | |
108 | endif | |
109 | ||
110 | if exists("g:jellybeans_background_color") | |
111 | let s:overrides["background"]["guibg"] = g:jellybeans_background_color | |
112 | endif | |
113 | ||
114 | if exists("g:jellybeans_background_color_256") | |
115 | let s:overrides["background"]["256ctermbg"] = g:jellybeans_background_color_256 | |
116 | endif | |
117 | ||
118 | if exists("g:jellybeans_use_term_background_color") | |
119 | \ && g:jellybeans_use_term_background_color | |
120 | let s:overrides["background"]["ctermbg"] = "NONE" | |
121 | let s:overrides["background"]["256ctermbg"] = "NONE" | |
122 | endif | |
123 | endif | |
124 | ||
125 | if exists("g:jellybeans_use_lowcolor_black") && g:jellybeans_use_lowcolor_black | |
126 | let s:termBlack = "Black" | |
127 | else | |
128 | let s:termBlack = "Grey" | |
129 | endif | |
130 | ||
131 | " When `termguicolors` is set, Vim[^1] ignores `hi Normal guibg=NONE` | |
132 | " after Normal's `guibg` is already set to a color. See: | |
133 | " | |
134 | " - https://github.com/vim/vim/issues/981 | |
135 | " - https://github.com/nanotech/jellybeans.vim/issues/64 | |
136 | " | |
137 | " To work around this, ensure we don't set the default background | |
138 | " color before an override changes it to `NONE` by ensuring that the | |
139 | " background color isn't set to a value different from its override. | |
140 | " | |
141 | " [^1]: Tested on 8.0.567. Does not apply to Neovim. | |
142 | " | |
143 | if has_key(s:overrides, "background") && has_key(s:overrides["background"], "guibg") | |
144 | let s:background_color = s:overrides["background"]["guibg"] | |
145 | endif | |
146 | ||
1 | 147 | " Color approximation functions by Henry So, Jr. and David Liang {{{ |
148 | " Added to jellybeans.vim by Daniel Herbert | |
149 | ||
863 | 150 | if &t_Co == 88 |
151 | ||
152 | " returns an approximate grey index for the given grey level | |
153 | fun! s:grey_number(x) | |
1 | 154 | if a:x < 23 |
155 | return 0 | |
156 | elseif a:x < 69 | |
157 | return 1 | |
158 | elseif a:x < 103 | |
159 | return 2 | |
160 | elseif a:x < 127 | |
161 | return 3 | |
162 | elseif a:x < 150 | |
163 | return 4 | |
164 | elseif a:x < 173 | |
165 | return 5 | |
166 | elseif a:x < 196 | |
167 | return 6 | |
168 | elseif a:x < 219 | |
169 | return 7 | |
170 | elseif a:x < 243 | |
171 | return 8 | |
172 | else | |
173 | return 9 | |
174 | endif | |
863 | 175 | endfun |
1 | 176 | |
863 | 177 | " returns the actual grey level represented by the grey index |
178 | fun! s:grey_level(n) | |
1 | 179 | if a:n == 0 |
180 | return 0 | |
181 | elseif a:n == 1 | |
182 | return 46 | |
183 | elseif a:n == 2 | |
184 | return 92 | |
185 | elseif a:n == 3 | |
186 | return 115 | |
187 | elseif a:n == 4 | |
188 | return 139 | |
189 | elseif a:n == 5 | |
190 | return 162 | |
191 | elseif a:n == 6 | |
192 | return 185 | |
193 | elseif a:n == 7 | |
194 | return 208 | |
195 | elseif a:n == 8 | |
196 | return 231 | |
197 | else | |
198 | return 255 | |
199 | endif | |
863 | 200 | endfun |
1 | 201 | |
863 | 202 | " returns the palette index for the given grey index |
203 | fun! s:grey_color(n) | |
1 | 204 | if a:n == 0 |
205 | return 16 | |
206 | elseif a:n == 9 | |
207 | return 79 | |
208 | else | |
209 | return 79 + a:n | |
210 | endif | |
863 | 211 | endfun |
1 | 212 | |
863 | 213 | " returns an approximate color index for the given color level |
214 | fun! s:rgb_number(x) | |
1 | 215 | if a:x < 69 |
216 | return 0 | |
217 | elseif a:x < 172 | |
218 | return 1 | |
219 | elseif a:x < 230 | |
220 | return 2 | |
221 | else | |
222 | return 3 | |
223 | endif | |
863 | 224 | endfun |
225 | ||
226 | " returns the actual color level for the given color index | |
227 | fun! s:rgb_level(n) | |
228 | if a:n == 0 | |
229 | return 0 | |
230 | elseif a:n == 1 | |
231 | return 139 | |
232 | elseif a:n == 2 | |
233 | return 205 | |
234 | else | |
235 | return 255 | |
236 | endif | |
237 | endfun | |
238 | ||
239 | " returns the palette index for the given R/G/B color indices | |
240 | fun! s:rgb_color(x, y, z) | |
241 | return 16 + (a:x * 16) + (a:y * 4) + a:z | |
242 | endfun | |
243 | ||
244 | else " assuming &t_Co == 256 | |
245 | ||
246 | " returns an approximate grey index for the given grey level | |
247 | fun! s:grey_number(x) | |
248 | if a:x < 14 | |
249 | return 0 | |
250 | else | |
251 | let l:n = (a:x - 8) / 10 | |
252 | let l:m = (a:x - 8) % 10 | |
253 | if l:m < 5 | |
254 | return l:n | |
255 | else | |
256 | return l:n + 1 | |
257 | endif | |
258 | endif | |
259 | endfun | |
260 | ||
261 | " returns the actual grey level represented by the grey index | |
262 | fun! s:grey_level(n) | |
263 | if a:n == 0 | |
264 | return 0 | |
265 | else | |
266 | return 8 + (a:n * 10) | |
267 | endif | |
268 | endfun | |
269 | ||
270 | " returns the palette index for the given grey index | |
271 | fun! s:grey_color(n) | |
272 | if a:n == 0 | |
273 | return 16 | |
274 | elseif a:n == 25 | |
275 | return 231 | |
276 | else | |
277 | return 231 + a:n | |
278 | endif | |
279 | endfun | |
280 | ||
281 | " returns an approximate color index for the given color level | |
282 | fun! s:rgb_number(x) | |
1 | 283 | if a:x < 75 |
284 | return 0 | |
285 | else | |
286 | let l:n = (a:x - 55) / 40 | |
287 | let l:m = (a:x - 55) % 40 | |
288 | if l:m < 20 | |
289 | return l:n | |
290 | else | |
291 | return l:n + 1 | |
292 | endif | |
293 | endif | |
863 | 294 | endfun |
1 | 295 | |
863 | 296 | " returns the actual color level for the given color index |
297 | fun! s:rgb_level(n) | |
1 | 298 | if a:n == 0 |
299 | return 0 | |
300 | else | |
301 | return 55 + (a:n * 40) | |
302 | endif | |
863 | 303 | endfun |
1 | 304 | |
863 | 305 | " returns the palette index for the given R/G/B color indices |
306 | fun! s:rgb_color(x, y, z) | |
1 | 307 | return 16 + (a:x * 36) + (a:y * 6) + a:z |
863 | 308 | endfun |
309 | ||
310 | endif | |
1 | 311 | |
312 | " returns the palette index to approximate the given R/G/B color levels | |
313 | fun! s:color(r, g, b) | |
863 | 314 | " map greys directly (see xterm's 256colres.pl) |
315 | if &t_Co == 256 && a:r == a:g && a:g == a:b && a:r > 3 && a:r < 243 | |
316 | return (a:r - 8) / 10 + 232 | |
317 | endif | |
318 | ||
1 | 319 | " get the closest grey |
320 | let l:gx = s:grey_number(a:r) | |
321 | let l:gy = s:grey_number(a:g) | |
322 | let l:gz = s:grey_number(a:b) | |
323 | ||
324 | " get the closest color | |
325 | let l:x = s:rgb_number(a:r) | |
326 | let l:y = s:rgb_number(a:g) | |
327 | let l:z = s:rgb_number(a:b) | |
328 | ||
329 | if l:gx == l:gy && l:gy == l:gz | |
330 | " there are two possibilities | |
331 | let l:dgr = s:grey_level(l:gx) - a:r | |
332 | let l:dgg = s:grey_level(l:gy) - a:g | |
333 | let l:dgb = s:grey_level(l:gz) - a:b | |
334 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) | |
335 | let l:dr = s:rgb_level(l:gx) - a:r | |
336 | let l:dg = s:rgb_level(l:gy) - a:g | |
337 | let l:db = s:rgb_level(l:gz) - a:b | |
338 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) | |
339 | if l:dgrey < l:drgb | |
340 | " use the grey | |
341 | return s:grey_color(l:gx) | |
342 | else | |
343 | " use the color | |
344 | return s:rgb_color(l:x, l:y, l:z) | |
345 | endif | |
346 | else | |
347 | " only one possibility | |
348 | return s:rgb_color(l:x, l:y, l:z) | |
349 | endif | |
350 | endfun | |
351 | ||
863 | 352 | fun! s:is_empty_or_none(str) |
353 | return empty(a:str) || a:str ==? "NONE" | |
354 | endfun | |
355 | ||
1 | 356 | " returns the palette index to approximate the 'rrggbb' hex string |
357 | fun! s:rgb(rgb) | |
863 | 358 | if s:is_empty_or_none(a:rgb) |
359 | return "NONE" | |
360 | endif | |
1 | 361 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 |
362 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 | |
363 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 | |
364 | return s:color(l:r, l:g, l:b) | |
365 | endfun | |
366 | ||
863 | 367 | fun! s:prefix_highlight_value_with(prefix, color) |
368 | if s:is_empty_or_none(a:color) | |
369 | return "NONE" | |
370 | else | |
371 | return a:prefix . a:color | |
372 | endif | |
373 | endfun | |
374 | ||
375 | fun! s:remove_italic_attr(attr) | |
376 | let l:attr = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",") | |
377 | if empty(l:attr) | |
378 | let l:attr = "NONE" | |
379 | endif | |
380 | return l:attr | |
381 | endfun | |
382 | ||
1 | 383 | " sets the highlighting for the given group |
384 | fun! s:X(group, fg, bg, attr, lcfg, lcbg) | |
385 | if s:low_color | |
863 | 386 | let l:cmd = "hi ".a:group. |
387 | \ " ctermfg=".s:prefix_highlight_value_with("", a:lcfg). | |
388 | \ " ctermbg=".s:prefix_highlight_value_with("", a:lcbg) | |
1 | 389 | else |
863 | 390 | let l:cmd = "hi ".a:group. |
391 | \ " guifg=".s:prefix_highlight_value_with("#", a:fg). | |
392 | \ " guibg=".s:prefix_highlight_value_with("#", a:bg) | |
393 | if !s:true_color | |
394 | let l:cmd = l:cmd. | |
395 | \ " ctermfg=".s:rgb(a:fg). | |
396 | \ " ctermbg=".s:rgb(a:bg) | |
1 | 397 | endif |
398 | endif | |
399 | ||
863 | 400 | let l:attr = s:prefix_highlight_value_with("", a:attr) |
401 | ||
402 | if exists("g:jellybeans_use_term_italics") && g:jellybeans_use_term_italics | |
403 | let l:cterm_attr = l:attr | |
1 | 404 | else |
863 | 405 | let l:cterm_attr = s:remove_italic_attr(l:attr) |
1 | 406 | endif |
863 | 407 | |
408 | if !exists("g:jellybeans_use_gui_italics") || g:jellybeans_use_gui_italics | |
409 | let l:gui_attr = l:attr | |
410 | else | |
411 | let l:gui_attr = s:remove_italic_attr(l:attr) | |
412 | endif | |
413 | ||
414 | let l:cmd = l:cmd." gui=".l:gui_attr." cterm=".l:cterm_attr | |
415 | exec l:cmd | |
1 | 416 | endfun |
417 | " }}} | |
418 | ||
863 | 419 | call s:X("Normal","e8e8d3",s:background_color,"","White","") |
1 | 420 | set background=dark |
421 | ||
863 | 422 | call s:X("CursorLine","","1c1c1c","","",s:termBlack) |
423 | call s:X("CursorColumn","","1c1c1c","","",s:termBlack) | |
1 | 424 | |
863 | 425 | " Some of Terminal.app's default themes have a cursor color |
426 | " too close to Jellybeans' preferred MatchParen background | |
427 | " color to be easily distinguishable. Other terminals tend | |
428 | " to use a brighter cursor color. | |
429 | " | |
430 | " Use a more distinct color in Terminal.app, and also in | |
431 | " low-color terminals if the preferred background color is | |
432 | " not available. | |
433 | if !has('gui_running') && $TERM_PROGRAM == "Apple_Terminal" | |
434 | let s:matchParenGuiFg = "dd0093" | |
435 | let s:matchParenGuiBg = "000000" | |
436 | else | |
437 | let s:matchParenGuiFg = "ffffff" | |
438 | let s:matchParenGuiBg = "556779" | |
439 | endif | |
440 | if s:termBlack != "Black" | |
441 | let s:matchParenTermFg = "Magenta" | |
442 | let s:matchParenTermBg = "" | |
443 | else | |
444 | let s:matchParenTermFg = "" | |
445 | let s:matchParenTermBg = s:termBlack | |
446 | endif | |
447 | call s:X("MatchParen",s:matchParenGuiFg,s:matchParenGuiBg,"bold", | |
448 | \ s:matchParenTermFg,s:matchParenTermBg) | |
1 | 449 | |
863 | 450 | call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack) |
451 | call s:X("TabLineFill","9098a0","","","",s:termBlack) | |
452 | call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White") | |
1 | 453 | |
863 | 454 | " Auto-completion |
455 | call s:X("Pmenu","ffffff","606060","","White",s:termBlack) | |
456 | call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White") | |
1 | 457 | |
458 | call s:X("Visual","","404040","","",s:termBlack) | |
863 | 459 | call s:X("Cursor",s:background_color,"b0d0f0","","","") |
1 | 460 | |
863 | 461 | call s:X("LineNr","605958",s:background_color,"NONE",s:termBlack,"") |
462 | call s:X("CursorLineNr","ccc5c4","","NONE","White","") | |
1 | 463 | call s:X("Comment","888888","","italic","Grey","") |
464 | call s:X("Todo","c7c7c7","","bold","White",s:termBlack) | |
465 | ||
466 | call s:X("StatusLine","000000","dddddd","italic","","White") | |
467 | call s:X("StatusLineNC","ffffff","403c41","italic","White","Black") | |
468 | call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack) | |
469 | call s:X("WildMenu","f0a0c0","302028","","Magenta","") | |
470 | ||
471 | call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"") | |
472 | call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack) | |
473 | call s:X("SignColumn","777777","333333","","",s:termBlack) | |
474 | call s:X("ColorColumn","","000000","","",s:termBlack) | |
475 | ||
476 | call s:X("Title","70b950","","bold","Green","") | |
477 | ||
478 | call s:X("Constant","cf6a4c","","","Red","") | |
479 | call s:X("Special","799d6a","","","Green","") | |
480 | call s:X("Delimiter","668799","","","Grey","") | |
481 | ||
482 | call s:X("String","99ad6a","","","Green","") | |
483 | call s:X("StringDelimiter","556633","","","DarkGreen","") | |
484 | ||
485 | call s:X("Identifier","c6b6ee","","","LightCyan","") | |
486 | call s:X("Structure","8fbfdc","","","LightCyan","") | |
487 | call s:X("Function","fad07a","","","Yellow","") | |
488 | call s:X("Statement","8197bf","","","DarkBlue","") | |
489 | call s:X("PreProc","8fbfdc","","","LightBlue","") | |
490 | ||
491 | hi! link Operator Structure | |
863 | 492 | hi! link Conceal Operator |
1 | 493 | |
494 | call s:X("Type","ffb964","","","Yellow","") | |
863 | 495 | call s:X("NonText","606060",s:background_color,"",s:termBlack,"") |
1 | 496 | |
497 | call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"") | |
498 | ||
499 | call s:X("Search","f0a0c0","302028","underline","Magenta","") | |
500 | ||
501 | call s:X("Directory","dad085","","","Yellow","") | |
502 | call s:X("ErrorMsg","","902020","","","DarkRed") | |
503 | hi! link Error ErrorMsg | |
504 | hi! link MoreMsg Special | |
505 | call s:X("Question","65C254","","","Green","") | |
506 | ||
507 | ||
508 | " Spell Checking | |
509 | ||
510 | call s:X("SpellBad","","902020","underline","","DarkRed") | |
511 | call s:X("SpellCap","","0000df","underline","","Blue") | |
512 | call s:X("SpellRare","","540063","underline","","DarkMagenta") | |
513 | call s:X("SpellLocal","","2D7067","underline","","Green") | |
514 | ||
515 | " Diff | |
516 | ||
517 | hi! link diffRemoved Constant | |
518 | hi! link diffAdded String | |
519 | ||
520 | " VimDiff | |
521 | ||
522 | call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen") | |
523 | call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed") | |
524 | call s:X("DiffChange","","2B5B77","","White","DarkBlue") | |
525 | call s:X("DiffText","8fbfdc","000000","reverse","Yellow","") | |
526 | ||
527 | " PHP | |
528 | ||
529 | hi! link phpFunctions Function | |
530 | call s:X("StorageClass","c59f6f","","","Red","") | |
531 | hi! link phpSuperglobal Identifier | |
532 | hi! link phpQuoteSingle StringDelimiter | |
533 | hi! link phpQuoteDouble StringDelimiter | |
534 | hi! link phpBoolean Constant | |
535 | hi! link phpNull Constant | |
536 | hi! link phpArrayPair Operator | |
537 | hi! link phpOperator Normal | |
538 | hi! link phpRelation Normal | |
539 | hi! link phpVarSelector Identifier | |
540 | ||
541 | " Python | |
542 | ||
543 | hi! link pythonOperator Statement | |
544 | ||
545 | " Ruby | |
546 | ||
547 | hi! link rubySharpBang Comment | |
548 | call s:X("rubyClass","447799","","","DarkBlue","") | |
549 | call s:X("rubyIdentifier","c6b6fe","","","Cyan","") | |
550 | hi! link rubyConstant Type | |
551 | hi! link rubyFunction Function | |
552 | ||
553 | call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","") | |
554 | call s:X("rubySymbol","7697d6","","","Blue","") | |
555 | hi! link rubyGlobalVariable rubyInstanceVariable | |
556 | hi! link rubyModule rubyClass | |
557 | call s:X("rubyControl","7597c6","","","Blue","") | |
558 | ||
559 | hi! link rubyString String | |
560 | hi! link rubyStringDelimiter StringDelimiter | |
561 | hi! link rubyInterpolationDelimiter Identifier | |
562 | ||
563 | call s:X("rubyRegexpDelimiter","540063","","","Magenta","") | |
564 | call s:X("rubyRegexp","dd0093","","","DarkMagenta","") | |
565 | call s:X("rubyRegexpSpecial","a40073","","","Magenta","") | |
566 | ||
567 | call s:X("rubyPredefinedIdentifier","de5577","","","Red","") | |
568 | ||
569 | " Erlang | |
570 | ||
571 | hi! link erlangAtom rubySymbol | |
572 | hi! link erlangBIF rubyPredefinedIdentifier | |
573 | hi! link erlangFunction rubyPredefinedIdentifier | |
574 | hi! link erlangDirective Statement | |
575 | hi! link erlangNode Identifier | |
576 | ||
863 | 577 | " Elixir |
578 | ||
579 | hi! link elixirAtom rubySymbol | |
580 | ||
581 | ||
1 | 582 | " JavaScript |
583 | ||
584 | hi! link javaScriptValue Constant | |
585 | hi! link javaScriptRegexpString rubyRegexp | |
863 | 586 | hi! link javaScriptTemplateVar StringDelim |
587 | hi! link javaScriptTemplateDelim Identifier | |
588 | hi! link javaScriptTemplateString String | |
1 | 589 | |
590 | " CoffeeScript | |
591 | ||
592 | hi! link coffeeRegExp javaScriptRegexpString | |
593 | ||
594 | " Lua | |
595 | ||
596 | hi! link luaOperator Conditional | |
597 | ||
598 | " C | |
599 | ||
600 | hi! link cFormat Identifier | |
601 | hi! link cOperator Constant | |
602 | ||
603 | " Objective-C/Cocoa | |
604 | ||
605 | hi! link objcClass Type | |
606 | hi! link cocoaClass objcClass | |
607 | hi! link objcSubclass objcClass | |
608 | hi! link objcSuperclass objcClass | |
609 | hi! link objcDirective rubyClass | |
610 | hi! link objcStatement Constant | |
611 | hi! link cocoaFunction Function | |
612 | hi! link objcMethodName Identifier | |
613 | hi! link objcMethodArg Normal | |
614 | hi! link objcMessageName Identifier | |
615 | ||
616 | " Vimscript | |
617 | ||
618 | hi! link vimOper Normal | |
619 | ||
863 | 620 | " HTML |
621 | ||
622 | hi! link htmlTag Statement | |
623 | hi! link htmlEndTag htmlTag | |
624 | hi! link htmlTagName htmlTag | |
625 | ||
626 | " XML | |
627 | ||
628 | hi! link xmlTag Statement | |
629 | hi! link xmlEndTag xmlTag | |
630 | hi! link xmlTagName xmlTag | |
631 | hi! link xmlEqual xmlTag | |
632 | hi! link xmlEntity Special | |
633 | hi! link xmlEntityPunct xmlEntity | |
634 | hi! link xmlDocTypeDecl PreProc | |
635 | hi! link xmlDocTypeKeyword PreProc | |
636 | hi! link xmlProcessingDelim xmlAttrib | |
637 | ||
1 | 638 | " Debugger.vim |
639 | ||
640 | call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue") | |
641 | call s:X("DbgBreakPt","","4F0037","","","DarkMagenta") | |
642 | ||
643 | " vim-indent-guides | |
644 | ||
645 | if !exists("g:indent_guides_auto_colors") | |
646 | let g:indent_guides_auto_colors = 0 | |
647 | endif | |
648 | call s:X("IndentGuidesOdd","","232323","","","") | |
649 | call s:X("IndentGuidesEven","","1b1b1b","","","") | |
650 | ||
651 | " Plugins, etc. | |
652 | ||
653 | hi! link TagListFileName Directory | |
654 | call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green") | |
655 | ||
656 | " Manual overrides for 256-color terminals. Dark colors auto-map badly. | |
657 | if !s:low_color | |
658 | hi StatusLineNC ctermbg=235 | |
659 | hi Folded ctermbg=236 | |
660 | hi DiffText ctermfg=81 | |
661 | hi DbgBreakPt ctermbg=53 | |
662 | hi IndentGuidesOdd ctermbg=235 | |
663 | hi IndentGuidesEven ctermbg=234 | |
664 | endif | |
665 | ||
863 | 666 | if !empty("s:overrides") |
667 | fun! s:current_attr(group) | |
668 | let l:synid = synIDtrans(hlID(a:group)) | |
669 | let l:attrs = [] | |
670 | for l:attr in ["bold", "italic", "reverse", "standout", "underline", "undercurl"] | |
671 | if synIDattr(l:synid, l:attr, "gui") == 1 | |
672 | call add(l:attrs, l:attr) | |
673 | endif | |
674 | endfor | |
675 | return join(l:attrs, ",") | |
676 | endfun | |
677 | fun! s:current_color(group, what, mode) | |
678 | let l:color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode) | |
679 | if l:color == -1 | |
680 | return "" | |
681 | else | |
682 | return substitute(l:color, "^#", "", "") | |
683 | endif | |
684 | endfun | |
685 | fun! s:load_color_def(group, def) | |
686 | call s:X(a:group, get(a:def, "guifg", s:current_color(a:group, "fg", "gui")), | |
687 | \ get(a:def, "guibg", s:current_color(a:group, "bg", "gui")), | |
688 | \ get(a:def, "attr", s:current_attr(a:group)), | |
689 | \ get(a:def, "ctermfg", s:current_color(a:group, "fg", "cterm")), | |
690 | \ get(a:def, "ctermbg", s:current_color(a:group, "bg", "cterm"))) | |
691 | if !s:low_color | |
692 | for l:prop in ["ctermfg", "ctermbg"] | |
693 | let l:override_key = "256".l:prop | |
694 | if has_key(a:def, l:override_key) | |
695 | exec "hi ".a:group." ".l:prop."=".a:def[l:override_key] | |
696 | endif | |
697 | endfor | |
698 | endif | |
699 | endfun | |
1 | 700 | fun! s:load_colors(defs) |
863 | 701 | for [l:group, l:def] in items(a:defs) |
702 | if l:group == "background" | |
703 | call s:load_color_def("LineNr", l:def) | |
704 | call s:load_color_def("NonText", l:def) | |
705 | call s:load_color_def("Normal", l:def) | |
706 | else | |
707 | call s:load_color_def(l:group, l:def) | |
1 | 708 | endif |
709 | unlet l:group | |
863 | 710 | unlet l:def |
1 | 711 | endfor |
712 | endfun | |
863 | 713 | call s:load_colors(s:overrides) |
1 | 714 | delf s:load_colors |
863 | 715 | delf s:load_color_def |
716 | delf s:current_color | |
717 | delf s:current_attr | |
1 | 718 | endif |
719 | ||
720 | " delete functions {{{ | |
721 | delf s:X | |
863 | 722 | delf s:remove_italic_attr |
723 | delf s:prefix_highlight_value_with | |
1 | 724 | delf s:rgb |
863 | 725 | delf s:is_empty_or_none |
1 | 726 | delf s:color |
727 | delf s:rgb_color | |
728 | delf s:rgb_level | |
729 | delf s:rgb_number | |
730 | delf s:grey_color | |
731 | delf s:grey_level | |
732 | delf s:grey_number | |
733 | " }}} |