detailed.vim 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. " Source repo: http://github.com/rking/vim-detailed
  2. "
  3. " So many 256-color schemes merely shift the palette around, displaying only 8
  4. " colors (even though they're a *different* set of 8 colors than default).
  5. "
  6. " This scheme is more detailed than that.
  7. "
  8. " Your eyes will learn to pick up on subtler patterns without requiring as
  9. " much from your conscious mind. Instead of the goal being merely looking
  10. " cool, the goal is to maximize info bandwidth from the computer to the brain.
  11. " The regexes, for example, are much easier to pick out. The overall feel of a
  12. " given file becomes much more intuitively recognizeable (you'll know you're
  13. " in foo.rb, not bar.rb, without having to read any text). Certain bits will
  14. " "pop" into being the right colors, such as the difference between
  15. " "RUBY_VERISON" and "RUBY_VERSION", or # encoding: utf-8
  16. "
  17. " ## 256 Color Requirement
  18. "
  19. " If you aren't getting 256 colors, you aren't getting detailed.vim.
  20. " Typically, you'll have to make sure your `$TERM` variable is set right. This
  21. " can get un-set by some programs, such as tmux. So you can force it to
  22. " something like:
  23. "
  24. " export TERM=screen-256color
  25. " # or:
  26. " export TERM=xterm-256color
  27. "
  28. " If these are unavailable on the target system, you might have to place a
  29. " terminfo file in `~/.terminfo/` -or- you can be totally gross and force it
  30. " with `:set &t_Co=256` in vim. But don't be gross. It's uncouth.
  31. "
  32. " ## Color Choices
  33. "
  34. " As a historical note, some small effort was taken to be similar to the
  35. " default vim syntax highlighting where it makes sense. That is, "def" is
  36. " magenta in the default, so vim-detailed makes it a shade of purple (and uses
  37. " different shades for all the other magenta things from the default
  38. " colorscheme). A person could modify this idea and do better:
  39. "
  40. " - Greens - The 256 color palette itself is heavy on green variants. If you
  41. " used more greens, you'd be able to group similar-but-different pieces
  42. " together more closely.
  43. " - Coolness - If you adjusted the color choices for æsthetic value rather than
  44. " utilitarian, you could get a more stylish theme without sacrificing much
  45. " detail.
  46. "
  47. " ## Download
  48. "
  49. " If using Pathogen,
  50. "
  51. " cd ~/.vim/bundle && git clone https://github.com/rking/vim-detailed
  52. "
  53. " If using no vim plugin manager:
  54. "
  55. " mkdir -p ~/.vim/colors/ && cd $_ && wget https://raw.github.com/rking/vim-detailed/master/colors/detailed.vim
  56. "
  57. " ## Setup
  58. "
  59. " In your ~/.vimrc (or ~/.vim/plugin/colorscheme.vim if you like to organize):
  60. "
  61. " colo detailed
  62. "
  63. " This enables it globally. If you want to just do it for a trial, as long as
  64. " you have done one of the steps in the "Download" section, above, you can do:
  65. "
  66. " vim foo.rb +colo\ detailed
  67. "
  68. " Or, from within vim:
  69. "
  70. " :colo detailed
  71. let colors_name = 'detailed'
  72. " Prevent any screwy setting from causing errors:
  73. let s:save_cpo = &cpo | set cpo&vim
  74. " Turn on moar syntaks!
  75. let ruby_operators = 1
  76. " If you don't have this, rails.vim will zap the matchers when it resets
  77. " syntax for its own additions:
  78. au Syntax * call s:fatpacked_rainbow_parens()
  79. au Syntax ruby call s:detailed_syntax_addtions()
  80. " Show detailed syntax stack
  81. nmap <Leader>dets :call <SID>SynStack()<CR>
  82. fun! <SID>SynStack()
  83. echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
  84. endfun
  85. " Color Palette {{{
  86. " Boring ctermfg ⇒ guifg map {{{
  87. let s:cterm_gui_map = {
  88. \0: '000000',
  89. \1: 'ff0000',
  90. \2: '00ff00',
  91. \3: 'ffff00',
  92. \4: '0000ff',
  93. \5: 'ff00ff',
  94. \6: '00ffff',
  95. \16: '000000',
  96. \17: '00005f',
  97. \18: '000087',
  98. \19: '0000af',
  99. \20: '0000d7',
  100. \21: '0000ff',
  101. \22: '005f00',
  102. \23: '005f5f',
  103. \24: '005f87',
  104. \25: '005faf',
  105. \26: '005fd7',
  106. \27: '005fff',
  107. \28: '008700',
  108. \29: '00875f',
  109. \30: '008787',
  110. \31: '0087af',
  111. \32: '0087d7',
  112. \33: '0087ff',
  113. \34: '00af00',
  114. \35: '00af5f',
  115. \36: '00af87',
  116. \37: '00afaf',
  117. \38: '00afd7',
  118. \39: '00afff',
  119. \40: '00d700',
  120. \41: '00d75f',
  121. \42: '00d787',
  122. \43: '00d7af',
  123. \44: '00d7d7',
  124. \45: '00d7ff',
  125. \46: '00ff00',
  126. \47: '00ff5f',
  127. \48: '00ff87',
  128. \49: '00ffaf',
  129. \50: '00ffd7',
  130. \51: '00ffff',
  131. \52: '5f0000',
  132. \53: '5f005f',
  133. \54: '5f0087',
  134. \55: '5f00af',
  135. \56: '5f00d7',
  136. \57: '5f00ff',
  137. \58: '5f5f00',
  138. \59: '5f5f5f',
  139. \60: '5f5f87',
  140. \61: '5f5faf',
  141. \62: '5f5fd7',
  142. \63: '5f5fff',
  143. \64: '5f8700',
  144. \65: '5f875f',
  145. \66: '5f8787',
  146. \67: '5f87af',
  147. \68: '5f87d7',
  148. \69: '5f87ff',
  149. \70: '5faf00',
  150. \71: '5faf5f',
  151. \72: '5faf87',
  152. \73: '5fafaf',
  153. \74: '5fafd7',
  154. \75: '5fafff',
  155. \76: '5fd700',
  156. \77: '5fd75f',
  157. \78: '5fd787',
  158. \79: '5fd7af',
  159. \80: '5fd7d7',
  160. \81: '5fd7ff',
  161. \82: '5fff00',
  162. \83: '5fff5f',
  163. \84: '5fff87',
  164. \85: '5fffaf',
  165. \86: '5fffd7',
  166. \87: '5fffff',
  167. \88: '870000',
  168. \89: '87005f',
  169. \90: '870087',
  170. \91: '8700af',
  171. \92: '8700d7',
  172. \93: '8700ff',
  173. \94: '875f00',
  174. \95: '875f5f',
  175. \96: '875f87',
  176. \97: '875faf',
  177. \98: '875fd7',
  178. \99: '875fff',
  179. \100: '878700',
  180. \101: '87875f',
  181. \102: '878787',
  182. \103: '8787af',
  183. \104: '8787d7',
  184. \105: '8787ff',
  185. \106: '87af00',
  186. \107: '87af5f',
  187. \108: '87af87',
  188. \109: '87afaf',
  189. \110: '87afd7',
  190. \111: '87afff',
  191. \112: '87d700',
  192. \113: '87d75f',
  193. \114: '87d787',
  194. \115: '87d7af',
  195. \116: '87d7d7',
  196. \117: '87d7ff',
  197. \118: '87ff00',
  198. \119: '87ff5f',
  199. \120: '87ff87',
  200. \121: '87ffaf',
  201. \122: '87ffd7',
  202. \123: '87ffff',
  203. \124: 'af0000',
  204. \125: 'af005f',
  205. \126: 'af0087',
  206. \127: 'af00af',
  207. \128: 'af00d7',
  208. \129: 'af00ff',
  209. \130: 'af5f00',
  210. \131: 'af5f5f',
  211. \132: 'af5f87',
  212. \133: 'af5faf',
  213. \134: 'af5fd7',
  214. \135: 'af5fff',
  215. \136: 'af8700',
  216. \137: 'af875f',
  217. \138: 'af8787',
  218. \139: 'af87af',
  219. \140: 'af87d7',
  220. \141: 'af87ff',
  221. \142: 'afaf00',
  222. \143: 'afaf5f',
  223. \144: 'afaf87',
  224. \145: 'afafaf',
  225. \146: 'afafd7',
  226. \147: 'afafff',
  227. \148: 'afd700',
  228. \149: 'afd75f',
  229. \150: 'afd787',
  230. \151: 'afd7af',
  231. \152: 'afd7d7',
  232. \153: 'afd7ff',
  233. \154: 'afff00',
  234. \155: 'afff5f',
  235. \156: 'afff87',
  236. \157: 'afffaf',
  237. \158: 'afffd7',
  238. \159: 'afffff',
  239. \160: 'd70000',
  240. \161: 'd7005f',
  241. \162: 'd70087',
  242. \163: 'd700af',
  243. \164: 'd700d7',
  244. \165: 'd700ff',
  245. \166: 'd75f00',
  246. \167: 'd75f5f',
  247. \168: 'd75f87',
  248. \169: 'd75faf',
  249. \170: 'd75fd7',
  250. \171: 'd75fff',
  251. \172: 'd78700',
  252. \173: 'd7875f',
  253. \174: 'd78787',
  254. \175: 'd787af',
  255. \176: 'd787d7',
  256. \177: 'd787ff',
  257. \178: 'd7af00',
  258. \179: 'd7af5f',
  259. \180: 'd7af87',
  260. \181: 'd7afaf',
  261. \182: 'd7afd7',
  262. \183: 'd7afff',
  263. \184: 'd7d700',
  264. \185: 'd7d75f',
  265. \186: 'd7d787',
  266. \187: 'd7d7af',
  267. \188: 'd7d7d7',
  268. \189: 'd7d7ff',
  269. \190: 'd7ff00',
  270. \191: 'd7ff5f',
  271. \192: 'd7ff87',
  272. \193: 'd7ffaf',
  273. \194: 'd7ffd7',
  274. \195: 'd7ffff',
  275. \196: 'ff0000',
  276. \197: 'ff005f',
  277. \198: 'ff0087',
  278. \199: 'ff00af',
  279. \200: 'ff00d7',
  280. \201: 'ff00ff',
  281. \202: 'ff5f00',
  282. \203: 'ff5f5f',
  283. \204: 'ff5f87',
  284. \205: 'ff5faf',
  285. \206: 'ff5fd7',
  286. \207: 'ff5fff',
  287. \208: 'ff8700',
  288. \209: 'ff875f',
  289. \210: 'ff8787',
  290. \211: 'ff87af',
  291. \212: 'ff87d7',
  292. \213: 'ff87ff',
  293. \214: 'ffaf00',
  294. \215: 'ffaf5f',
  295. \216: 'ffaf87',
  296. \217: 'ffafaf',
  297. \218: 'ffafd7',
  298. \219: 'ffafff',
  299. \220: 'ffd700',
  300. \221: 'ffd75f',
  301. \222: 'ffd787',
  302. \223: 'ffd7af',
  303. \224: 'ffd7d7',
  304. \225: 'ffd7ff',
  305. \226: 'ffff00',
  306. \227: 'ffff5f',
  307. \228: 'ffff87',
  308. \229: 'ffffaf',
  309. \230: 'ffffd7',
  310. \231: 'ffffff',
  311. \232: '080808',
  312. \233: '121212',
  313. \234: '1c1c1c',
  314. \235: '262626',
  315. \236: '303030',
  316. \237: '3a3a3a',
  317. \238: '444444',
  318. \239: '4e4e4e',
  319. \240: '585858',
  320. \241: '626262',
  321. \242: '6c6c6c',
  322. \243: '767676',
  323. \244: '808080',
  324. \245: '8a8a8a',
  325. \246: '949494',
  326. \247: '9e9e9e',
  327. \248: 'a8a8a8',
  328. \249: 'b2b2b2',
  329. \250: 'bcbcbc',
  330. \251: 'c6c6c6',
  331. \252: 'd0d0d0',
  332. \253: 'dadada',
  333. \254: 'e4e4e4',
  334. \255: 'eeeeee',
  335. \}
  336. " }}}
  337. let s:c = {
  338. \'basic8_red (TODO: use this)': 1,
  339. \'basic8_green': 2,
  340. \'basic8_yellow': 3,
  341. \'basic8_blue (TODO: use this)': 4,
  342. \'basic8_magenta': 5,
  343. \'basic8_cyan': 6,
  344. \'basic8_black': 0,
  345. \'red52': 52,
  346. \'red88': 88,
  347. \'red124': 124,
  348. \'red160': 160,
  349. \'red161': 161,
  350. \'red196': 196,
  351. \'yellow58': 58,
  352. \'yellow100': 100,
  353. \'yellow136 (TODO: use this)': 136,
  354. \'yellow142 (TODO: use this)': 142,
  355. \'yellow148': 148,
  356. \'yellow149': 149,
  357. \'yellow190': 190,
  358. \'yellow220 (TODO: use this)': 220,
  359. \'yellow228': 228,
  360. \'orange208': 208,
  361. \'orange178': 178,
  362. \'orange180': 180,
  363. \'orange222': 222,
  364. \'light_yellow230': 229,
  365. \'graygreen (TODO: use this)': 23,
  366. \'green22': 22,
  367. \'green23': 23,
  368. \'green34': 34,
  369. \'green71': 71,
  370. \'green76': 76,
  371. \'green84': 84,
  372. \'green123': 123,
  373. \'seafoam': 30,
  374. \'seafoam2 (TODO: use this)': 35,
  375. \'teal50': 50,
  376. \'blue17 (TODO: use this)': 17,
  377. \'blue19 (TODO: use this)': 19,
  378. \'blue20 (TODO: use this)': 20,
  379. \'blue25': 25,
  380. \'blue27': 27,
  381. \'blue33': 33,
  382. \'blue37': 37,
  383. \'blue75': 75,
  384. \'blue87': 87,
  385. \'lavender104': 104,
  386. \'purple53': 53,
  387. \'purple89 (TODO: use this)': 89,
  388. \'purple90': 90,
  389. \'purple95 (TODO: use this)': 95,
  390. \'purple99 (TODO: use this)': 79,
  391. \'purple125': 125,
  392. \'purple126': 126,
  393. \'purple127 (TODO: use this)': 127,
  394. \'purple129 (TODO: use this)': 129,
  395. \'purple131': 131,
  396. \'purple141 (TODO: use this)': 141,
  397. \'purple161 (TODO: use this)': 161,
  398. \'purple201': 201,
  399. \'purple224': 224,
  400. \'purple225': 225,
  401. \'gray16': 16,
  402. \'gray232': 232,
  403. \'gray233': 233,
  404. \'gray234': 234,
  405. \'gray235': 235,
  406. \'gray236': 236,
  407. \'gray237': 237,
  408. \'gray238': 238,
  409. \'gray239': 239,
  410. \'gray240': 240,
  411. \'gray241': 241,
  412. \'gray242': 242,
  413. \'gray243': 243,
  414. \'gray244': 244,
  415. \'gray245': 245,
  416. \'gray246': 246,
  417. \'gray247': 247,
  418. \'gray248': 248,
  419. \'gray249': 249,
  420. \'gray250': 250,
  421. \'gray251': 251,
  422. \'gray252': 252,
  423. \'gray253': 253,
  424. \'gray254': 254,
  425. \'gray255': 255,
  426. \}
  427. " }}}
  428. " :hi funcs {{{
  429. fun! s:color_for(id, fgbg)
  430. let num = s:c[a:id]
  431. let gui = s:cterm_gui_map[l:num]
  432. return 'cterm'.a:fgbg.'='.l:num.' gui'.a:fgbg.'=#'.l:gui
  433. endfun
  434. fun! s:fg(group, fg)
  435. exe 'hi '.a:group.' '.s:color_for(a:fg,'fg')
  436. endfun
  437. fun! s:bg(group, bg)
  438. exe 'hi '.a:group.' '.s:color_for(a:bg,'bg')
  439. endfun
  440. fun! s:fgbg(group, fg, bg)
  441. exe 'hi '.a:group.' '.s:color_for(a:fg,'fg').' '.s:color_for(a:bg,'bg')
  442. endfun
  443. fun! s:bold_fg(group, fg)
  444. exe 'hi '.a:group.' '.s:color_for(a:fg,'fg').' cterm=bold gui=bold'
  445. endfun
  446. fun! s:underline_fgbg(group, fg, bg)
  447. exe 'hi '.a:group.' ctermfg='.s:c[a:fg].' '
  448. \s:color_for(a:bg,'bg').' cterm=underline,bold gui=underline,bold'
  449. endfun
  450. fun! s:make_obvious(group)
  451. call s:fgbg(a:group, 'green84', 'red160')
  452. endfun
  453. " }}}
  454. " For now, force darkness. If you're a big fan of white bg's, let me know, and
  455. " we can collaborate on a solution.
  456. set bg=dark
  457. hi Normal ctermfg=254 ctermbg=0
  458. call s:fgbg('Normal', 'gray254', 'basic8_black')
  459. " Note: ctermbg=233 was my previous value before user feedback. Any opinions?
  460. " Basic/Default-like Palette {{{
  461. hi SpecialKey term=bold ctermfg=81 guifg=Cyan
  462. hi NonText term=bold ctermfg=12 gui=bold guifg=Blue
  463. hi Directory term=bold ctermfg=159 guifg=Cyan
  464. hi ErrorMsg term=standout ctermfg=15 ctermbg=1 guifg=White guibg=Red
  465. hi IncSearch term=reverse cterm=reverse gui=reverse
  466. hi Search term=reverse ctermfg=0 ctermbg=11 guifg=Black guibg=Yellow
  467. hi MoreMsg term=bold ctermfg=121 gui=bold guifg=SeaGreen
  468. hi ModeMsg term=bold cterm=bold gui=bold
  469. hi LineNr term=underline ctermfg=11 guifg=Yellow
  470. hi CursorLineNr term=bold ctermfg=11 gui=bold guifg=Yellow
  471. hi Question term=standout ctermfg=121 gui=bold guifg=Green
  472. hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold,reverse
  473. hi StatusLineNC term=reverse cterm=reverse gui=reverse
  474. hi VertSplit term=reverse cterm=reverse gui=reverse
  475. hi Title term=bold ctermfg=225 gui=bold guifg=Magenta
  476. hi Visual term=reverse ctermbg=242 guibg=DarkGrey
  477. hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline
  478. hi WarningMsg term=standout ctermfg=224 guifg=Red
  479. hi WildMenu term=standout ctermfg=0 ctermbg=11 guifg=Black guibg=Yellow
  480. hi Folded term=standout ctermfg=14 ctermbg=242 guifg=Cyan guibg=DarkGrey
  481. hi FoldColumn term=standout ctermfg=14 ctermbg=242 guifg=Cyan guibg=Grey
  482. hi DiffAdd term=bold ctermbg=4 guibg=DarkBlue
  483. hi DiffChange term=bold ctermbg=5 guibg=DarkMagenta
  484. hi DiffDelete term=bold ctermfg=12 ctermbg=6 gui=bold guifg=Blue guibg=DarkCyan
  485. hi DiffText term=reverse cterm=bold ctermbg=9 gui=bold guibg=Red
  486. hi SignColumn term=standout ctermfg=14 ctermbg=242 guifg=Cyan guibg=Grey
  487. hi Conceal ctermfg=7 ctermbg=242 guifg=LightGrey guibg=DarkGrey
  488. hi SpellBad term=reverse ctermbg=9 gui=undercurl guisp=Red
  489. hi SpellCap term=reverse ctermbg=12 gui=undercurl guisp=Blue
  490. hi SpellRare term=reverse ctermbg=13 gui=undercurl guisp=Magenta
  491. hi SpellLocal term=underline ctermbg=14 gui=undercurl guisp=Cyan
  492. hi Pmenu ctermfg=0 ctermbg=13 guibg=Magenta
  493. hi PmenuSel ctermfg=0 ctermbg=242 guibg=DarkGrey
  494. hi PmenuSbar ctermbg=248 guibg=Grey
  495. hi PmenuThumb ctermbg=15 guibg=White
  496. hi TabLine term=underline cterm=underline ctermfg=15 ctermbg=242 gui=underline guibg=DarkGrey
  497. hi TabLineSel term=bold cterm=bold gui=bold
  498. hi TabLineFill term=reverse cterm=reverse gui=reverse
  499. hi CursorColumn term=reverse ctermbg=242 guibg=Grey40
  500. hi CursorLine term=underline cterm=underline guibg=Grey40
  501. hi ColorColumn term=reverse ctermfg=9 ctermbg=12 guifg=black guibg=lightgrey
  502. hi MatchParen term=reverse ctermbg=6 guibg=DarkCyan
  503. hi Constant term=underline ctermfg=13 guifg=#ffa0a0
  504. hi Special term=bold ctermfg=224 guifg=Orange
  505. hi Identifier term=underline cterm=bold ctermfg=14 guifg=#40ffff
  506. hi Statement term=bold ctermfg=11 gui=bold guifg=#ffff60
  507. hi PreProc term=underline ctermfg=81 guifg=#ff80ff
  508. hi Type term=underline ctermfg=121 gui=bold guifg=#60ff60
  509. hi Underlined term=underline cterm=underline ctermfg=81 gui=underline guifg=#80a0ff
  510. hi Ignore ctermfg=0 guifg=bg
  511. hi Error term=reverse ctermfg=15 ctermbg=9 guifg=White guibg=Red
  512. hi Todo term=standout ctermfg=0 ctermbg=11 guifg=Blue guibg=Yellow
  513. call s:fg('Comment', 'gray242') " In my books, comments should be quiet.
  514. " }}}
  515. " Default links {{{
  516. hi link String Constant
  517. hi link Character Constant
  518. hi link Number Constant
  519. hi link Boolean Constant
  520. hi link Float Number
  521. hi link Function Identifier
  522. hi link Conditional Statement
  523. hi link Repeat Statement
  524. hi link Label Statement
  525. hi link Operator Statement
  526. hi link Keyword Statement
  527. hi link Include PreProc
  528. hi link Define PreProc
  529. hi link Macro PreProc
  530. hi link PreCondit PreProc
  531. hi link StorageClass Type
  532. hi link Structure Type
  533. hi link Typedef Type
  534. hi link Tag Special
  535. hi link SpecialChar Special
  536. hi link Delimiter Special
  537. hi link SpecialComment Special
  538. hi link Debug Special
  539. hi link mailQuoted1 Type
  540. hi link GPGWarning WarningMsg
  541. hi link GPGError ErrorMsg
  542. hi link GPGHighlightUnknownRecipient ErrorMsg
  543. hi link rubyConditional Conditional
  544. hi link rubyExceptional rubyConditional " No-show.
  545. hi link rubyMethodExceptional rubyDefine " And another.
  546. hi link rubyStringEscape Special
  547. hi link rubyQuoteEscape rubyStringEscape
  548. " hi rubyInterpolation cleared
  549. hi link rubyInvalidVariable Error
  550. hi link rubyNoInterpolation rubyString " E.g. \#{} inside a string.
  551. hi link rubyException Exception
  552. hi link rubyKeyword Keyword
  553. "}}}
  554. " s:detailed_colors — the good stuff {{{
  555. fun! s:detailed_colors()
  556. " vimdiff uses Diff*
  557. call s:bg('DiffChange', 'gray240')
  558. call s:bg('DiffText', 'gray232')
  559. call s:bg('DiffAdd', 'green23')
  560. call s:bg('DiffDelete', 'yellow58')
  561. " ft=diff syntax uses diff*
  562. call s:fg('diffAdded', 'green34')
  563. call s:fg('diffRemoved', 'yellow58')
  564. " diffFile
  565. call s:fg('rubyConstant', 'green34')
  566. call s:bold_fg('rubyClass', 'purple126')
  567. call s:fg('rubyModule', 'purple126')
  568. call s:fg('rubyDefine', 'basic8_magenta')
  569. call s:fg('rubyInclude', 'purple53')
  570. call s:bold_fg('rubyFunction', 'blue27')
  571. " No-show: call s:make_obvious('rubyMethodDeclaration')
  572. call s:fg('rubyInstanceVariable', 'blue75')
  573. call s:fgbg('rubyString', 'red160', 'gray233')
  574. call s:fg('rubyStringDelimiter', 'blue33')
  575. call s:fg('rubyInterpolationDelimiter', 'gray244')
  576. call s:fg('rubyRegexpSpecial', 'seafoam')
  577. hi link rubyRegexpComment Comment
  578. " Not quite sure why these don't show up:
  579. " call s:make_obvious('rubyRegexpParens')
  580. " call s:make_obvious('rubyRegexpBrackets')
  581. call s:fg('rubyRegexpCharClass', 'basic8_green')
  582. call s:fg('rubyRegexpQuantifier', 'yellow148')
  583. call s:bold_fg('rubyRegexpEscape', 'purple90')
  584. call s:fg('rubyRegexpAnchor', 'purple90')
  585. call s:fg('rubyRegexpDot', 'green34')
  586. call s:bold_fg('rubyRegexpDelimiter', 'red88')
  587. call s:fgbg('rubyRegexp', 'red160', 'gray233')
  588. call s:fg('rubyASCIICode', 'green71')
  589. call s:fg('rubyPseudoVariable', 'purple125')
  590. call s:fg('rubyInteger', 'red124')
  591. call s:fg('rubyFloat', 'red160')
  592. call s:fg('rubyBlockArgument', 'blue87')
  593. call s:fg('rubySymbol', 'lavender104')
  594. call s:bold_fg('rubyBlockParameter', 'basic8_cyan')
  595. call s:fg('rubyBlockParameterList', 'blue25')
  596. call s:bold_fg('rubyPredefinedConstant', 'green22')
  597. call s:bold_fg('rubyPredefinedVariable', 'blue37')
  598. " XXX no clue why this wont show up: call s:make_obvious('rubyHeredocStart')
  599. " TODO: fix these: call s:make_obvious('rubyAliasDeclaration2')
  600. " call s:make_obvious('rubyAliasDeclaration')
  601. call s:fg('rubyBoolean', 'purple131')
  602. call s:fg('rubyOperator', 'green123')
  603. hi link rubyPseudoOperator rubyOperator " -= /= **= *= etc
  604. " TODO! call s:make_obvious('rubyClassDeclaration')
  605. " call s:make_obvious('rubyDeclaration')
  606. " call s:make_obvious('rubyModuleDeclaration')
  607. hi link rubyBeginEnd Statement " TODO
  608. call s:fg('rubyAccess', 'yellow100')
  609. call s:fg('rubyAttribute', 'orange178') " attr_{accessor,reader,writer}
  610. call s:fg('rubyEval', 'yellow190')
  611. " Blocks:
  612. " (basic)
  613. call s:fg('rubyMethodBlock', 'purple224')
  614. call s:fg('rubyBlock', 'purple225')
  615. call s:fg('rubyBlockExpression', 'orange180')
  616. " (conditionals)
  617. call s:fg('rubyControl', 'orange178')
  618. call s:bold_fg('Conditional', 'basic8_yellow')
  619. call s:bold_fg('rubyConditionalModifier', 'yellow148') " 'Yoda if'
  620. call s:fg('rubyConditionalExpression', 'light_yellow230')
  621. hi link rubyCaseExpression rubyConditionalExpression
  622. " (loops)
  623. call s:fg('rubyRepeat', 'orange178')
  624. call s:bold_fg('rubyRepeatModifier', 'yellow149') " …while/until
  625. call s:fg('rubyRepeatExpression', 'orange222')
  626. hi link rubyDoBlock rubyRepeatExpression
  627. " TODO: call s:make_obvious('rubyOptionalDo')
  628. " TODO: call s:make_obvious('rubyOptionalDoLine')
  629. call s:fg('rubySharpBang', 'gray251')
  630. hi link rubyFirstAndSecondCommentLine rubySharpBang
  631. hi link rubyComment Comment
  632. " hi rubyMultilineComment cleared
  633. hi link rubyDocumentation Comment
  634. call s:fg('rubyDataDirective', 'purple201')
  635. call s:fg('rubyData', 'gray245')
  636. "* Distinguish between each of TODO/FIXME/XXX
  637. call s:fgbg('detailTodo', 'green76', 'gray238')
  638. call s:fgbg('detailFixme', 'gray232', 'orange208')
  639. call s:fgbg('detailXxx', 'gray235', 'red196')
  640. call s:fgbg('Error', 'gray235', 'red196')
  641. call s:underline_fgbg('Search', 'gray254', 'gray235')
  642. " https://github.com/bitc/vim-bad-whitespace
  643. call s:fgbg('BadWhitespace', 'gray238', 'yellow58')
  644. hi link rubySpaceError BadWhitespace
  645. "* `fail`/`raise`/`exit` were yellow by default, but here a more warny orange.
  646. call s:fg('Exception', 'orange208')
  647. hi link rubyExits Exception
  648. "* class `@@vars` get ugly, cautionary color: they are troublesome.
  649. call s:fgbg('rubyClassVariable', 'blue75', 'red52')
  650. "* global `$vars` also get a bit of ugliness. Everyone knows they're iffy.
  651. call s:fgbg('rubyGlobalVariable', 'red161', 'gray234')
  652. " rails.vim niceness:
  653. call s:fg('rubyRailsARAssociationMethod', 'teal50')
  654. " detailed.vim especialties:
  655. call s:fg('rubyInitialize', 'green84')
  656. call s:bold_fg('rubyEncodingDirective', 'green22')
  657. " Only linked highlights, not actual syntax:
  658. " call s:make_obvious('rubyIdentifier')
  659. " call s:make_obvious('rubyError')
  660. " Pretty much just the leftover default:
  661. " call s:make_obvious('rubyLocalVariableOrMethod')
  662. " Gets all [{()}] within any {}'s. Not very useful AFAICT:
  663. " call s:make_obvious('rubyCurlyBlock')
  664. " These mess up on first ] of [a[1]]. Seems plain busted.
  665. " call s:make_obvious('rubyArrayDelimiter')
  666. " call s:make_obvious('rubyArrayLiteral')
  667. " Mere implementation details, AFAICT:
  668. " call s:make_obvious('rubyNestedParentheses')
  669. " call s:make_obvious('rubyNestedCurlyBraces')
  670. " call s:make_obvious('rubyNestedAngleBrackets')
  671. " call s:make_obvious('rubyNestedSquareBrackets')
  672. " call s:make_obvious('rubyDelimEscape')
  673. " call s:make_obvious('rubySymbolDelimiter')
  674. endfun
  675. " }}}
  676. fun! s:detailed_syntax_addtions()
  677. call s:detailed_colors()
  678. " The default syntax/ruby.vim gets this way wrong (only does 2 chars and is
  679. " transparent):
  680. syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]*" contains=NONE display
  681. " Steal this back from the too-generic 'rubyControl':
  682. syn match rubyExits "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|trap\)\>[?!]\@!\)"
  683. " Bonus!
  684. syn match rubyInitialize '\<initialize\>' contained containedin=rubyMethodDeclaration
  685. syn match rubyEncodingDirective "\cencoding: *utf-8" contained
  686. " TODO - make this more elegant.
  687. syn match rubyFirstAndSecondCommentLine '\%^#.*'
  688. \ contains=rubyEncodingDirective contained
  689. syn match rubyFirstAndSecondCommentLine '\%^#.*\n#.*'
  690. \ contains=rubyEncodingDirective contained
  691. syn keyword detailTodo TODO contained
  692. syn keyword detailFixme FIXME contained
  693. syn keyword detailXxx XXX contained
  694. syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,
  695. \rubyFirstAndSecondCommentLine,detailTodo,detailFixme,detailXxx,@Spell
  696. " TODO - somehow make the detail{Todo,Fixme,Xxx} work for non-ruby langs.
  697. endfun
  698. call s:detailed_syntax_addtions()
  699. " Rainbow-Parens Improved {{{
  700. " Inlined from v2.3 of http://www.vim.org/scripts/script.php?script_id=4176
  701. " 1. to remove the external dep, 2. to work around vim-rails resetting it.
  702. " Thanks!
  703. fun! s:fatpacked_rainbow_parens()
  704. let guifgs = exists('g:rainbow_guifgs')? g:rainbow_guifgs : [
  705. \ 'DarkOrchid3', 'RoyalBlue3', 'SeaGreen3',
  706. \ 'DarkOrange3', 'FireBrick',
  707. \ ]
  708. let ctermfgs = exists('g:rainbow_ctermfgs')? g:rainbow_ctermfgs : [
  709. \ 'darkgray', 'Darkblue', 'darkmagenta',
  710. \ 'darkcyan', 'darkred', 'darkgreen',
  711. \ ]
  712. let max = has('gui_running')? len(guifgs) : len(ctermfgs)
  713. let cmd = 'syn region %s matchgroup=%s start=/%s/ end=/%s/ containedin=%s contains=%s'
  714. let str = 'TOP'
  715. for each in range(1, max)
  716. let str .= ',lv'.each
  717. endfor
  718. for [left , right] in [['(',')'],['\[','\]'],['{','}']]
  719. for each in range(1, max - 1)
  720. exe printf(cmd, 'lv'.each, 'lv'.each.'c', left, right, 'lv'.(each+1) , str)
  721. endfor
  722. exe printf(cmd, 'lv'.max, 'lv'.max.'c', left, right, 'lv1' , str)
  723. endfor
  724. for id in range(1 , max)
  725. let ctermfg = ctermfgs[(max - id) % len(ctermfgs)]
  726. let guifg = guifgs[(max - id) % len(guifgs)]
  727. exe 'hi default lv'.id.'c ctermfg='.ctermfg.' guifg='.guifg
  728. endfor
  729. endfun
  730. " }}}
  731. let &cpo = s:save_cpo
  732. " vim:foldmethod=marker