tomorrowEighties.vim 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. " Tomorrow Night Eighties - Full Colour and 256 Colour
  2. " http://chriskempson.com
  3. "
  4. " Hex colour conversion functions borrowed from the theme "Desert256""
  5. " Default GUI Colours
  6. let s:foreground = "cccccc"
  7. let s:background = "2d2d2d"
  8. let s:selection = "515151"
  9. let s:line = "393939"
  10. let s:comment = "999999"
  11. let s:red = "f2777a"
  12. let s:orange = "f99157"
  13. let s:yellow = "ffcc66"
  14. let s:green = "99cc99"
  15. let s:aqua = "66cccc"
  16. let s:blue = "6699cc"
  17. let s:purple = "cc99cc"
  18. let s:window = "4d5057"
  19. hi clear
  20. syntax reset
  21. let g:colors_name = "Tomorrow-Night-Eighties"
  22. if has("gui_running") || &t_Co == 88 || &t_Co == 256
  23. " Returns an approximate grey index for the given grey level
  24. fun <SID>grey_number(x)
  25. if &t_Co == 88
  26. if a:x < 23
  27. return 0
  28. elseif a:x < 69
  29. return 1
  30. elseif a:x < 103
  31. return 2
  32. elseif a:x < 127
  33. return 3
  34. elseif a:x < 150
  35. return 4
  36. elseif a:x < 173
  37. return 5
  38. elseif a:x < 196
  39. return 6
  40. elseif a:x < 219
  41. return 7
  42. elseif a:x < 243
  43. return 8
  44. else
  45. return 9
  46. endif
  47. else
  48. if a:x < 14
  49. return 0
  50. else
  51. let l:n = (a:x - 8) / 10
  52. let l:m = (a:x - 8) % 10
  53. if l:m < 5
  54. return l:n
  55. else
  56. return l:n + 1
  57. endif
  58. endif
  59. endif
  60. endfun
  61. " Returns the actual grey level represented by the grey index
  62. fun <SID>grey_level(n)
  63. if &t_Co == 88
  64. if a:n == 0
  65. return 0
  66. elseif a:n == 1
  67. return 46
  68. elseif a:n == 2
  69. return 92
  70. elseif a:n == 3
  71. return 115
  72. elseif a:n == 4
  73. return 139
  74. elseif a:n == 5
  75. return 162
  76. elseif a:n == 6
  77. return 185
  78. elseif a:n == 7
  79. return 208
  80. elseif a:n == 8
  81. return 231
  82. else
  83. return 255
  84. endif
  85. else
  86. if a:n == 0
  87. return 0
  88. else
  89. return 8 + (a:n * 10)
  90. endif
  91. endif
  92. endfun
  93. " Returns the palette index for the given grey index
  94. fun <SID>grey_colour(n)
  95. if &t_Co == 88
  96. if a:n == 0
  97. return 16
  98. elseif a:n == 9
  99. return 79
  100. else
  101. return 79 + a:n
  102. endif
  103. else
  104. if a:n == 0
  105. return 16
  106. elseif a:n == 25
  107. return 231
  108. else
  109. return 231 + a:n
  110. endif
  111. endif
  112. endfun
  113. " Returns an approximate colour index for the given colour level
  114. fun <SID>rgb_number(x)
  115. if &t_Co == 88
  116. if a:x < 69
  117. return 0
  118. elseif a:x < 172
  119. return 1
  120. elseif a:x < 230
  121. return 2
  122. else
  123. return 3
  124. endif
  125. else
  126. if a:x < 75
  127. return 0
  128. else
  129. let l:n = (a:x - 55) / 40
  130. let l:m = (a:x - 55) % 40
  131. if l:m < 20
  132. return l:n
  133. else
  134. return l:n + 1
  135. endif
  136. endif
  137. endif
  138. endfun
  139. " Returns the actual colour level for the given colour index
  140. fun <SID>rgb_level(n)
  141. if &t_Co == 88
  142. if a:n == 0
  143. return 0
  144. elseif a:n == 1
  145. return 139
  146. elseif a:n == 2
  147. return 205
  148. else
  149. return 255
  150. endif
  151. else
  152. if a:n == 0
  153. return 0
  154. else
  155. return 55 + (a:n * 40)
  156. endif
  157. endif
  158. endfun
  159. " Returns the palette index for the given R/G/B colour indices
  160. fun <SID>rgb_colour(x, y, z)
  161. if &t_Co == 88
  162. return 16 + (a:x * 16) + (a:y * 4) + a:z
  163. else
  164. return 16 + (a:x * 36) + (a:y * 6) + a:z
  165. endif
  166. endfun
  167. " Returns the palette index to approximate the given R/G/B colour levels
  168. fun <SID>colour(r, g, b)
  169. " Get the closest grey
  170. let l:gx = <SID>grey_number(a:r)
  171. let l:gy = <SID>grey_number(a:g)
  172. let l:gz = <SID>grey_number(a:b)
  173. " Get the closest colour
  174. let l:x = <SID>rgb_number(a:r)
  175. let l:y = <SID>rgb_number(a:g)
  176. let l:z = <SID>rgb_number(a:b)
  177. if l:gx == l:gy && l:gy == l:gz
  178. " There are two possibilities
  179. let l:dgr = <SID>grey_level(l:gx) - a:r
  180. let l:dgg = <SID>grey_level(l:gy) - a:g
  181. let l:dgb = <SID>grey_level(l:gz) - a:b
  182. let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
  183. let l:dr = <SID>rgb_level(l:gx) - a:r
  184. let l:dg = <SID>rgb_level(l:gy) - a:g
  185. let l:db = <SID>rgb_level(l:gz) - a:b
  186. let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
  187. if l:dgrey < l:drgb
  188. " Use the grey
  189. return <SID>grey_colour(l:gx)
  190. else
  191. " Use the colour
  192. return <SID>rgb_colour(l:x, l:y, l:z)
  193. endif
  194. else
  195. " Only one possibility
  196. return <SID>rgb_colour(l:x, l:y, l:z)
  197. endif
  198. endfun
  199. " Returns the palette index to approximate the 'rrggbb' hex string
  200. fun <SID>rgb(rgb)
  201. let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
  202. let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
  203. let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
  204. return <SID>colour(l:r, l:g, l:b)
  205. endfun
  206. " Sets the highlighting for the given group
  207. fun <SID>X(group, fg, bg, attr)
  208. if a:fg != ""
  209. exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
  210. endif
  211. if a:bg != ""
  212. exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
  213. endif
  214. if a:attr != ""
  215. exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
  216. endif
  217. endfun
  218. " Vim Highlighting
  219. call <SID>X("Normal", s:foreground, s:background, "")
  220. call <SID>X("LineNr", s:selection, "", "")
  221. call <SID>X("NonText", s:selection, "", "")
  222. call <SID>X("SpecialKey", s:selection, "", "")
  223. call <SID>X("Search", s:background, s:yellow, "")
  224. call <SID>X("TabLine", s:window, s:foreground, "reverse")
  225. call <SID>X("TabLineFill", s:window, s:foreground, "reverse")
  226. call <SID>X("StatusLine", s:window, s:yellow, "reverse")
  227. call <SID>X("StatusLineNC", s:window, s:foreground, "reverse")
  228. call <SID>X("VertSplit", s:window, s:window, "none")
  229. call <SID>X("Visual", "", s:selection, "")
  230. call <SID>X("Directory", s:blue, "", "")
  231. call <SID>X("ModeMsg", s:green, "", "")
  232. call <SID>X("MoreMsg", s:green, "", "")
  233. call <SID>X("Question", s:green, "", "")
  234. call <SID>X("WarningMsg", s:red, "", "")
  235. call <SID>X("MatchParen", "", s:selection, "")
  236. call <SID>X("Folded", s:comment, s:background, "")
  237. call <SID>X("FoldColumn", "", s:background, "")
  238. if version >= 700
  239. call <SID>X("CursorLine", "", s:line, "none")
  240. call <SID>X("CursorColumn", "", s:line, "none")
  241. call <SID>X("PMenu", s:foreground, s:selection, "none")
  242. call <SID>X("PMenuSel", s:foreground, s:selection, "reverse")
  243. call <SID>X("SignColumn", "", s:background, "none")
  244. end
  245. if version >= 703
  246. call <SID>X("ColorColumn", "", s:line, "none")
  247. end
  248. " Standard Highlighting
  249. call <SID>X("Comment", s:comment, "", "")
  250. call <SID>X("Todo", s:comment, s:background, "")
  251. call <SID>X("Title", s:comment, "", "")
  252. call <SID>X("Identifier", s:red, "", "none")
  253. call <SID>X("Statement", s:foreground, "", "")
  254. call <SID>X("Conditional", s:foreground, "", "")
  255. call <SID>X("Repeat", s:foreground, "", "")
  256. call <SID>X("Structure", s:purple, "", "")
  257. call <SID>X("Function", s:blue, "", "")
  258. call <SID>X("Constant", s:orange, "", "")
  259. call <SID>X("Keyword", s:orange, "", "")
  260. call <SID>X("String", s:green, "", "")
  261. call <SID>X("Special", s:foreground, "", "")
  262. call <SID>X("PreProc", s:purple, "", "")
  263. call <SID>X("Operator", s:aqua, "", "none")
  264. call <SID>X("Type", s:blue, "", "none")
  265. call <SID>X("Define", s:purple, "", "none")
  266. call <SID>X("Include", s:blue, "", "")
  267. "call <SID>X("Ignore", "666666", "", "")
  268. " Vim Highlighting
  269. call <SID>X("vimCommand", s:red, "", "none")
  270. " C Highlighting
  271. call <SID>X("cType", s:yellow, "", "")
  272. call <SID>X("cStorageClass", s:purple, "", "")
  273. call <SID>X("cConditional", s:purple, "", "")
  274. call <SID>X("cRepeat", s:purple, "", "")
  275. " PHP Highlighting
  276. call <SID>X("phpVarSelector", s:red, "", "")
  277. call <SID>X("phpKeyword", s:purple, "", "")
  278. call <SID>X("phpRepeat", s:purple, "", "")
  279. call <SID>X("phpConditional", s:purple, "", "")
  280. call <SID>X("phpStatement", s:purple, "", "")
  281. call <SID>X("phpMemberSelector", s:foreground, "", "")
  282. " Ruby Highlighting
  283. call <SID>X("rubySymbol", s:green, "", "")
  284. call <SID>X("rubyConstant", s:yellow, "", "")
  285. call <SID>X("rubyAccess", s:yellow, "", "")
  286. call <SID>X("rubyAttribute", s:blue, "", "")
  287. call <SID>X("rubyInclude", s:blue, "", "")
  288. call <SID>X("rubyLocalVariableOrMethod", s:orange, "", "")
  289. call <SID>X("rubyCurlyBlock", s:orange, "", "")
  290. call <SID>X("rubyStringDelimiter", s:green, "", "")
  291. call <SID>X("rubyInterpolationDelimiter", s:orange, "", "")
  292. call <SID>X("rubyConditional", s:purple, "", "")
  293. call <SID>X("rubyRepeat", s:purple, "", "")
  294. call <SID>X("rubyControl", s:purple, "", "")
  295. call <SID>X("rubyException", s:purple, "", "")
  296. " Crystal Highlighting
  297. call <SID>X("crystalSymbol", s:green, "", "")
  298. call <SID>X("crystalConstant", s:yellow, "", "")
  299. call <SID>X("crystalAccess", s:yellow, "", "")
  300. call <SID>X("crystalAttribute", s:blue, "", "")
  301. call <SID>X("crystalInclude", s:blue, "", "")
  302. call <SID>X("crystalLocalVariableOrMethod", s:orange, "", "")
  303. call <SID>X("crystalCurlyBlock", s:orange, "", "")
  304. call <SID>X("crystalStringDelimiter", s:green, "", "")
  305. call <SID>X("crystalInterpolationDelimiter", s:orange, "", "")
  306. call <SID>X("crystalConditional", s:purple, "", "")
  307. call <SID>X("crystalRepeat", s:purple, "", "")
  308. call <SID>X("crystalControl", s:purple, "", "")
  309. call <SID>X("crystalException", s:purple, "", "")
  310. " Python Highlighting
  311. call <SID>X("pythonInclude", s:purple, "", "")
  312. call <SID>X("pythonStatement", s:purple, "", "")
  313. call <SID>X("pythonConditional", s:purple, "", "")
  314. call <SID>X("pythonRepeat", s:purple, "", "")
  315. call <SID>X("pythonException", s:purple, "", "")
  316. call <SID>X("pythonFunction", s:blue, "", "")
  317. call <SID>X("pythonPreCondit", s:purple, "", "")
  318. call <SID>X("pythonRepeat", s:aqua, "", "")
  319. call <SID>X("pythonExClass", s:orange, "", "")
  320. " JavaScript Highlighting
  321. call <SID>X("javaScriptBraces", s:foreground, "", "")
  322. call <SID>X("javaScriptFunction", s:purple, "", "")
  323. call <SID>X("javaScriptConditional", s:purple, "", "")
  324. call <SID>X("javaScriptRepeat", s:purple, "", "")
  325. call <SID>X("javaScriptNumber", s:orange, "", "")
  326. call <SID>X("javaScriptMember", s:orange, "", "")
  327. call <SID>X("javascriptNull", s:orange, "", "")
  328. call <SID>X("javascriptGlobal", s:blue, "", "")
  329. call <SID>X("javascriptStatement", s:red, "", "")
  330. " CoffeeScript Highlighting
  331. call <SID>X("coffeeRepeat", s:purple, "", "")
  332. call <SID>X("coffeeConditional", s:purple, "", "")
  333. call <SID>X("coffeeKeyword", s:purple, "", "")
  334. call <SID>X("coffeeObject", s:yellow, "", "")
  335. " HTML Highlighting
  336. call <SID>X("htmlTag", s:red, "", "")
  337. call <SID>X("htmlTagName", s:red, "", "")
  338. call <SID>X("htmlArg", s:red, "", "")
  339. call <SID>X("htmlScriptTag", s:red, "", "")
  340. " Diff Highlighting
  341. call <SID>X("diffAdd", "", "4c4e39", "")
  342. call <SID>X("diffDelete", s:background, s:red, "")
  343. call <SID>X("diffChange", "", "2B5B77", "")
  344. call <SID>X("diffText", s:line, s:blue, "")
  345. " ShowMarks Highlighting
  346. call <SID>X("ShowMarksHLl", s:orange, s:background, "none")
  347. call <SID>X("ShowMarksHLo", s:purple, s:background, "none")
  348. call <SID>X("ShowMarksHLu", s:yellow, s:background, "none")
  349. call <SID>X("ShowMarksHLm", s:aqua, s:background, "none")
  350. " Lua Highlighting
  351. call <SID>X("luaStatement", s:purple, "", "")
  352. call <SID>X("luaRepeat", s:purple, "", "")
  353. call <SID>X("luaCondStart", s:purple, "", "")
  354. call <SID>X("luaCondElseif", s:purple, "", "")
  355. call <SID>X("luaCond", s:purple, "", "")
  356. call <SID>X("luaCondEnd", s:purple, "", "")
  357. " Cucumber Highlighting
  358. call <SID>X("cucumberGiven", s:blue, "", "")
  359. call <SID>X("cucumberGivenAnd", s:blue, "", "")
  360. " Go Highlighting
  361. call <SID>X("goDirective", s:purple, "", "")
  362. call <SID>X("goDeclaration", s:purple, "", "")
  363. call <SID>X("goStatement", s:purple, "", "")
  364. call <SID>X("goConditional", s:purple, "", "")
  365. call <SID>X("goConstants", s:orange, "", "")
  366. call <SID>X("goTodo", s:yellow, "", "")
  367. call <SID>X("goDeclType", s:blue, "", "")
  368. call <SID>X("goBuiltins", s:purple, "", "")
  369. call <SID>X("goRepeat", s:purple, "", "")
  370. call <SID>X("goLabel", s:purple, "", "")
  371. " Clojure Highlighting
  372. call <SID>X("clojureConstant", s:orange, "", "")
  373. call <SID>X("clojureBoolean", s:orange, "", "")
  374. call <SID>X("clojureCharacter", s:orange, "", "")
  375. call <SID>X("clojureKeyword", s:green, "", "")
  376. call <SID>X("clojureNumber", s:orange, "", "")
  377. call <SID>X("clojureString", s:green, "", "")
  378. call <SID>X("clojureRegexp", s:green, "", "")
  379. call <SID>X("clojureParen", s:aqua, "", "")
  380. call <SID>X("clojureVariable", s:yellow, "", "")
  381. call <SID>X("clojureCond", s:blue, "", "")
  382. call <SID>X("clojureDefine", s:purple, "", "")
  383. call <SID>X("clojureException", s:red, "", "")
  384. call <SID>X("clojureFunc", s:blue, "", "")
  385. call <SID>X("clojureMacro", s:blue, "", "")
  386. call <SID>X("clojureRepeat", s:blue, "", "")
  387. call <SID>X("clojureSpecial", s:purple, "", "")
  388. call <SID>X("clojureQuote", s:blue, "", "")
  389. call <SID>X("clojureUnquote", s:blue, "", "")
  390. call <SID>X("clojureMeta", s:blue, "", "")
  391. call <SID>X("clojureDeref", s:blue, "", "")
  392. call <SID>X("clojureAnonArg", s:blue, "", "")
  393. call <SID>X("clojureRepeat", s:blue, "", "")
  394. call <SID>X("clojureDispatch", s:blue, "", "")
  395. " Scala Highlighting
  396. call <SID>X("scalaKeyword", s:purple, "", "")
  397. call <SID>X("scalaKeywordModifier", s:purple, "", "")
  398. call <SID>X("scalaOperator", s:blue, "", "")
  399. call <SID>X("scalaPackage", s:red, "", "")
  400. call <SID>X("scalaFqn", s:foreground, "", "")
  401. call <SID>X("scalaFqnSet", s:foreground, "", "")
  402. call <SID>X("scalaImport", s:purple, "", "")
  403. call <SID>X("scalaBoolean", s:orange, "", "")
  404. call <SID>X("scalaDef", s:purple, "", "")
  405. call <SID>X("scalaVal", s:purple, "", "")
  406. call <SID>X("scalaVar", s:aqua, "", "")
  407. call <SID>X("scalaClass", s:purple, "", "")
  408. call <SID>X("scalaObject", s:purple, "", "")
  409. call <SID>X("scalaTrait", s:purple, "", "")
  410. call <SID>X("scalaDefName", s:blue, "", "")
  411. call <SID>X("scalaValName", s:foreground, "", "")
  412. call <SID>X("scalaVarName", s:foreground, "", "")
  413. call <SID>X("scalaClassName", s:foreground, "", "")
  414. call <SID>X("scalaType", s:yellow, "", "")
  415. call <SID>X("scalaTypeSpecializer", s:yellow, "", "")
  416. call <SID>X("scalaAnnotation", s:orange, "", "")
  417. call <SID>X("scalaNumber", s:orange, "", "")
  418. call <SID>X("scalaDefSpecializer", s:yellow, "", "")
  419. call <SID>X("scalaClassSpecializer", s:yellow, "", "")
  420. call <SID>X("scalaBackTick", s:green, "", "")
  421. call <SID>X("scalaRoot", s:foreground, "", "")
  422. call <SID>X("scalaMethodCall", s:blue, "", "")
  423. call <SID>X("scalaCaseType", s:yellow, "", "")
  424. call <SID>X("scalaLineComment", s:comment, "", "")
  425. call <SID>X("scalaComment", s:comment, "", "")
  426. call <SID>X("scalaDocComment", s:comment, "", "")
  427. call <SID>X("scalaDocTags", s:comment, "", "")
  428. call <SID>X("scalaEmptyString", s:green, "", "")
  429. call <SID>X("scalaMultiLineString", s:green, "", "")
  430. call <SID>X("scalaUnicode", s:orange, "", "")
  431. call <SID>X("scalaString", s:green, "", "")
  432. call <SID>X("scalaStringEscape", s:green, "", "")
  433. call <SID>X("scalaSymbol", s:orange, "", "")
  434. call <SID>X("scalaChar", s:orange, "", "")
  435. call <SID>X("scalaXml", s:green, "", "")
  436. call <SID>X("scalaConstructorSpecializer", s:yellow, "", "")
  437. call <SID>X("scalaBackTick", s:blue, "", "")
  438. " Git
  439. call <SID>X("diffAdded", s:green, "", "")
  440. call <SID>X("diffRemoved", s:red, "", "")
  441. call <SID>X("gitcommitSummary", "", "", "bold")
  442. " Delete Functions
  443. delf <SID>X
  444. delf <SID>rgb
  445. delf <SID>colour
  446. delf <SID>rgb_colour
  447. delf <SID>rgb_level
  448. delf <SID>rgb_number
  449. delf <SID>grey_colour
  450. delf <SID>grey_level
  451. delf <SID>grey_number
  452. endif
  453. set background=dark