gruvbox.vim 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  1. " -----------------------------------------------------------------------------
  2. " File: gruvbox.vim
  3. " Description: Retro groove color scheme for Vim
  4. " Author: morhetz <morhetz@gmail.com>
  5. " Source: https://github.com/morhetz/gruvbox
  6. " Last Modified: 10 Nov 2014
  7. " -----------------------------------------------------------------------------
  8. " Supporting code -------------------------------------------------------------
  9. " Initialisation: {{{
  10. if version > 580
  11. hi clear
  12. if exists("syntax_on")
  13. syntax reset
  14. endif
  15. endif
  16. let g:colors_name='gruvbox'
  17. if !has('gui_running') && &t_Co != 256
  18. finish
  19. endif
  20. " }}}
  21. " Global Settings: {{{
  22. if !exists('g:gruvbox_bold')
  23. let g:gruvbox_bold=1
  24. endif
  25. if !exists('g:gruvbox_italic')
  26. if has('gui_running') || $TERM_ITALICS == 'true'
  27. let g:gruvbox_italic=1
  28. else
  29. let g:gruvbox_italic=0
  30. endif
  31. endif
  32. if !exists('g:gruvbox_undercurl')
  33. let g:gruvbox_undercurl=1
  34. endif
  35. if !exists('g:gruvbox_underline')
  36. let g:gruvbox_underline=1
  37. endif
  38. if !exists('g:gruvbox_italicize_comments')
  39. let g:gruvbox_italicize_comments=1
  40. endif
  41. if !exists('g:gruvbox_italicize_strings')
  42. let g:gruvbox_italicize_strings=0
  43. endif
  44. if !exists('g:gruvbox_improved_strings')
  45. let g:gruvbox_improved_strings=0
  46. endif
  47. if !exists('g:gruvbox_improved_warnings')
  48. let g:gruvbox_improved_warnings=0
  49. endif
  50. if !exists('g:gruvbox_termcolors')
  51. let g:gruvbox_termcolors=256
  52. endif
  53. if !exists('g:gruvbox_invert_indent_guides')
  54. let g:gruvbox_invert_indent_guides=0
  55. endif
  56. if !exists('g:gruvbox_hls_cursor')
  57. let g:gruvbox_hls_cursor='orange'
  58. endif
  59. if !exists('g:gruvbox_sign_column')
  60. let g:gruvbox_sign_column='dark1'
  61. endif
  62. if !exists('g:gruvbox_color_column')
  63. let g:gruvbox_color_column='dark1'
  64. endif
  65. if !exists('g:gruvbox_vert_split')
  66. let g:gruvbox_vert_split='dark2'
  67. endif
  68. if !exists('g:gruvbox_invert_signs')
  69. let g:gruvbox_invert_signs=0
  70. endif
  71. if !exists('g:gruvbox_invert_selection')
  72. let g:gruvbox_invert_selection=1
  73. endif
  74. if !exists('g:gruvbox_contrast')
  75. let g:gruvbox_contrast='medium'
  76. endif
  77. if !exists('g:gruvbox_contrast_dark')
  78. let g:gruvbox_contrast_dark='medium'
  79. endif
  80. if !exists('g:gruvbox_contrast_light')
  81. let g:gruvbox_contrast_light='medium'
  82. endif
  83. if !exists('g:gruvbox_invert_tabline')
  84. let g:gruvbox_invert_tabline=0
  85. endif
  86. let s:is_dark=(&background == 'dark')
  87. " }}}
  88. " Palette: {{{
  89. let s:gb = {}
  90. if s:is_dark
  91. let s:gb.dark0 = ['282828', 235] " 40-40-40
  92. let s:gb.dark1 = ['3c3836', 237] " 60-56-54
  93. let s:gb.dark2 = ['504945', 239] " 80-73-69
  94. let s:gb.dark3 = ['665c54', 241] " 102-92-84
  95. let s:gb.dark4 = ['7c6f64', 243] " 124-111-100
  96. let s:gb.medium = ['928374', 245] " 146-131-116
  97. let s:gb.light0 = ['fdf4c1', 229] " 253-244-193
  98. let s:gb.light1 = ['ebdbb2', 223] " 235-219-178
  99. let s:gb.light2 = ['d5c4a1', 250] " 213-196-161
  100. let s:gb.light3 = ['bdae93', 248] " 189-174-147
  101. let s:gb.light4 = ['a89984', 246] " 168-153-132
  102. let s:gb.light4_256 = ['a89984', 246] " 168-153-132
  103. let s:gb.red = ['fb4934', 167] " 251-73-52
  104. let s:gb.green = ['b8bb26', 142] " 184-187-38
  105. let s:gb.yellow = ['fabd2f', 214] " 250-189-47
  106. let s:gb.blue = ['83a598', 109] " 131-165-152
  107. let s:gb.purple = ['d3869b', 175] " 211-134-155
  108. let s:gb.aqua = ['8ec07c', 108] " 142-192-124
  109. let s:gb.orange = ['fe8019', 208] " 254-128-25
  110. if g:gruvbox_termcolors == 16
  111. let s:gb.dark0 = ['282828', 0]
  112. let s:gb.light4 = ['a89984', 7]
  113. let s:gb.medium = ['928374', 8]
  114. let s:gb.red = ['fb4934', 9]
  115. let s:gb.green = ['b8bb26', 10]
  116. let s:gb.yellow = ['fabd2f', 11]
  117. let s:gb.blue = ['83a598', 12]
  118. let s:gb.purple = ['d3869b', 13]
  119. let s:gb.aqua = ['8ec07c', 14]
  120. let s:gb.light1 = ['ebdbb2', 15]
  121. endif
  122. if g:gruvbox_contrast == 'soft'
  123. let s:gb.dark0 = ['32302f', 236] " 50-48-47
  124. endif
  125. if g:gruvbox_contrast == 'hard'
  126. let s:gb.dark0 = ['1d2021', 234] " 29-32-33
  127. endif
  128. if g:gruvbox_contrast_dark == 'soft'
  129. let s:gb.dark0 = ['32302f', 236] " 50-48-47
  130. endif
  131. if g:gruvbox_contrast_dark == 'hard'
  132. let s:gb.dark0 = ['1d2021', 234] " 29-32-33
  133. endif
  134. else
  135. let s:gb.dark0 = ['fbf1c7', 229] " 251-241-199
  136. let s:gb.dark1 = ['ebdbb2', 223] " 235-219-178
  137. let s:gb.dark2 = ['d5c4a1', 250] " 213-196-161
  138. let s:gb.dark3 = ['bdae93', 248] " 189-174-147
  139. let s:gb.dark4 = ['a89984', 246] " 168-153-132
  140. let s:gb.medium = ['928374', 244] " 146-131-116
  141. let s:gb.light0 = ['282828', 235] " 40-40-40
  142. let s:gb.light1 = ['3c3836', 237] " 60-56-54
  143. let s:gb.light2 = ['504945', 239] " 80-73-69
  144. let s:gb.light3 = ['665c54', 241] " 102-92-84
  145. let s:gb.light4 = ['7c6f64', 243] " 124-111-100
  146. let s:gb.light4_256 = ['7c6f64', 243] " 124-111-100
  147. let s:gb.red = ['9d0006', 88] " 157-0-6
  148. let s:gb.green = ['79740e', 100] " 121-116-14
  149. let s:gb.yellow = ['b57614', 136] " 181-118-20
  150. let s:gb.blue = ['076678', 24] " 7-102-120
  151. let s:gb.purple = ['8f3f71', 96] " 143-63-113
  152. let s:gb.aqua = ['427b58', 66] " 66-123-88
  153. let s:gb.orange = ['af3a03', 130] " 175-58-3
  154. if g:gruvbox_termcolors == 16
  155. let s:gb.dark0 = ['fbf1c7', 0]
  156. let s:gb.light4 = ['7c6f64', 7]
  157. let s:gb.medium = ['928374', 8]
  158. let s:gb.red = ['9d0006', 9]
  159. let s:gb.green = ['79740e', 10]
  160. let s:gb.yellow = ['b57614', 11]
  161. let s:gb.blue = ['076678', 12]
  162. let s:gb.purple = ['8f3f71', 13]
  163. let s:gb.aqua = ['427b58', 14]
  164. let s:gb.light1 = ['3c3836', 15]
  165. endif
  166. if g:gruvbox_contrast == 'soft'
  167. let s:gb.dark0 = ['f2e5bc', 228] " 242-229-188
  168. endif
  169. if g:gruvbox_contrast == 'hard'
  170. let s:gb.dark0 = ['f9f5d7', 230] " 249-245-215
  171. endif
  172. if g:gruvbox_contrast_light == 'soft'
  173. let s:gb.dark0 = ['f2e5bc', 228] " 242-229-188
  174. endif
  175. if g:gruvbox_contrast_light == 'hard'
  176. let s:gb.dark0 = ['f9f5d7', 230] " 249-245-215
  177. endif
  178. endif
  179. " }}}
  180. " Highlighting Function: {{{
  181. function! s:HL(group, fg, ...)
  182. " Arguments: group, guifg, guibg, gui, guisp
  183. let histring = 'hi ' . a:group . ' '
  184. if strlen(a:fg)
  185. if a:fg == 'fg'
  186. let histring .= 'guifg=fg ctermfg=fg '
  187. elseif a:fg == 'bg'
  188. let histring .= 'guifg=bg ctermfg=bg '
  189. elseif a:fg == 'none'
  190. let histring .= 'guifg=NONE ctermfg=NONE '
  191. else
  192. let c = get(s:gb, a:fg)
  193. let histring .= 'guifg=#' . c[0] . ' ctermfg=' . c[1] . ' '
  194. endif
  195. endif
  196. if a:0 >= 1 && strlen(a:1)
  197. if a:1 == 'bg'
  198. let histring .= 'guibg=bg ctermbg=bg '
  199. elseif a:fg == 'fg'
  200. let histring .= 'guibg=fg ctermbg=fg '
  201. elseif a:1 == 'none'
  202. let histring .= 'guibg=NONE ctermbg=NONE '
  203. else
  204. let c = get(s:gb, a:1)
  205. let histring .= 'guibg=#' . c[0] . ' ctermbg=' . c[1] . ' '
  206. endif
  207. else
  208. let histring .= 'guibg=NONE ctermbg=NONE '
  209. endif
  210. " Hotfixing #24;
  211. " TODO: get rid of this spaghetti
  212. if a:0 >= 2 && strlen(a:2)
  213. if a:2 == 'none'
  214. let histring .= 'gui=NONE cterm=NONE '
  215. elseif a:2 == 'italic' && g:gruvbox_italic == 0
  216. let histring .= 'gui=NONE cterm=NONE '
  217. elseif a:2 == 'bold' && g:gruvbox_bold == 0
  218. let histring .= 'gui=NONE cterm=NONE '
  219. elseif a:2 == 'bold,inverse' && g:gruvbox_bold == 0
  220. let histring .= 'gui=inverse cterm=inverse '
  221. elseif a:2 == 'undercurl' && g:gruvbox_undercurl == 0
  222. let histring .= 'gui=NONE cterm=NONE '
  223. elseif a:2 == 'underline' && g:gruvbox_underline == 0
  224. let histring .= 'gui=NONE cterm=NONE '
  225. elseif a:2 == 'bold,italic'
  226. if g:gruvbox_italic == 0 && g:gruvbox_bold == 0
  227. let histring .= 'gui=NONE cterm=NONE '
  228. elseif g:gruvbox_italic == 0
  229. let histring .= 'gui=bold cterm=bold '
  230. elseif g:gruvbox_bold == 0
  231. let histring .= 'gui=italic cterm=italic '
  232. else
  233. let histring .= 'gui=' . a:2 . ' cterm=' . a:2 . ' '
  234. endif
  235. elseif a:2 == 'bold,underline'
  236. if g:gruvbox_underline == 0 && g:gruvbox_bold == 0
  237. let histring .= 'gui=NONE cterm=NONE '
  238. elseif g:gruvbox_underline == 0
  239. let histring .= 'gui=bold cterm=bold '
  240. elseif g:gruvbox_bold == 0
  241. let histring .= 'gui=underline cterm=underline '
  242. else
  243. let histring .= 'gui=' . a:2 . ' cterm=' . a:2 . ' '
  244. endif
  245. elseif a:2 == 'underline,italic'
  246. if g:gruvbox_underline == 0 && g:gruvbox_italic == 0
  247. let histring .= 'gui=NONE cterm=NONE '
  248. elseif g:gruvbox_underline == 0
  249. let histring .= 'gui=italic cterm=italic '
  250. elseif g:gruvbox_italic == 0
  251. let histring .= 'gui=underline cterm=underline '
  252. else
  253. let histring .= 'gui=' . a:2 . ' cterm=' . a:2 . ' '
  254. endif
  255. elseif a:2 == 'bold,underline,italic'
  256. if g:gruvbox_italic == 0 && g:gruvbox_bold == 0
  257. let histring .= 'gui=underline cterm=underline '
  258. elseif g:gruvbox_italic == 0
  259. let histring .= 'gui=bold,underline cterm=bold,underline '
  260. elseif g:gruvbox_bold == 0
  261. let histring .= 'gui=italic,underline cterm=italic,underline '
  262. else
  263. let histring .= 'gui=' . a:2 . ' cterm=' . a:2 . ' '
  264. endif
  265. else
  266. let histring .= 'gui=' . a:2 . ' cterm=' . a:2 . ' '
  267. endif
  268. else
  269. let histring .= 'gui=NONE cterm=NONE '
  270. endif
  271. if a:0 >= 3 && strlen(a:3)
  272. if a:3 == 'none'
  273. let histring .= 'guisp=NONE '
  274. else
  275. let c = get(s:gb, a:3)
  276. let histring .= 'guisp=#' . c[0] . ' '
  277. endif
  278. endif
  279. execute histring
  280. endfunction
  281. " }}}
  282. " Vanilla colorscheme ---------------------------------------------------------
  283. " General UI: {{{
  284. " Normal text
  285. call s:HL('Normal', 'light1', 'dark0')
  286. " Correct background (see issue #7):
  287. " --- Problem with changing between dark and light on 256 color terminal
  288. " --- https://github.com/morhetz/gruvbox/issues/7
  289. if s:is_dark
  290. set background=dark
  291. else
  292. set background=light
  293. endif
  294. if version >= 700
  295. " Screen line that the cursor is
  296. call s:HL('CursorLine', 'none', 'dark1')
  297. " Screen column that the cursor is
  298. call s:HL('CursorColumn', 'none', 'dark1')
  299. if g:gruvbox_invert_tabline == 0
  300. " Tab pages line filler
  301. call s:HL('TabLineFill', 'dark4', 'bg')
  302. " Active tab page label
  303. call s:HL('TabLineSel', 'bg', 'dark4', 'bold')
  304. " Not active tab page label
  305. call s:HL('TabLine', 'dark4', 'bg')
  306. else
  307. call s:HL('TabLineFill', 'bg', 'dark4')
  308. call s:HL('TabLineSel', 'dark4', 'bg', 'bold')
  309. call s:HL('TabLine', 'bg', 'dark4')
  310. endif
  311. " Match paired bracket under the cursor
  312. call s:HL('MatchParen', 'none', 'dark3', 'bold')
  313. endif
  314. if version >= 703
  315. " Highlighted screen columns
  316. call s:HL('ColorColumn', 'none', g:gruvbox_color_column)
  317. " Concealed element: \lambda → λ
  318. call s:HL('Conceal', 'blue', 'none')
  319. " Line number of CursorLine
  320. call s:HL('CursorLineNr', 'yellow', 'dark1')
  321. endif
  322. call s:HL('NonText', 'dark2')
  323. call s:HL('SpecialKey', 'dark2')
  324. if g:gruvbox_invert_selection == 0
  325. call s:HL('Visual', 'none', 'dark2')
  326. call s:HL('VisualNOS', 'none', 'dark2')
  327. else
  328. call s:HL('Visual', 'none', 'dark3', 'inverse')
  329. call s:HL('VisualNOS', 'none', 'dark3', 'inverse')
  330. endif
  331. call s:HL('Search', 'dark0', 'yellow')
  332. call s:HL('IncSearch', 'dark0', g:gruvbox_hls_cursor)
  333. call s:HL('Underlined', 'blue', 'none', 'underline')
  334. call s:HL('StatusLine', 'dark4', 'dark0', 'bold,inverse')
  335. call s:HL('StatusLineNC', 'dark2', 'light4', 'bold,inverse')
  336. " The column separating vertically split windows
  337. call s:HL('VertSplit', 'light4', g:gruvbox_vert_split)
  338. " Current match in wildmenu completion
  339. call s:HL('WildMenu', 'blue', 'dark2', 'bold')
  340. " Directory names, special names in listing
  341. call s:HL('Directory', 'green', 'none', 'bold')
  342. " Titles for output from :set all, :autocmd, etc.
  343. call s:HL('Title', 'green', 'none', 'bold')
  344. " Error messages on the command line
  345. call s:HL('ErrorMsg', 'bg', 'red', 'bold')
  346. " More prompt: -- More --
  347. call s:HL('MoreMsg', 'yellow', 'none', 'bold')
  348. " Current mode message: -- INSERT --
  349. call s:HL('ModeMsg', 'yellow', 'none', 'bold')
  350. " 'Press enter' prompt and yes/no questions
  351. call s:HL('Question', 'orange', 'none', 'bold')
  352. " Warning messages
  353. call s:HL('WarningMsg', 'red', 'none', 'bold')
  354. " }}}
  355. " Gutter: {{{
  356. " Line number for :number and :# commands
  357. call s:HL('LineNr', 'dark4')
  358. " Column where signs are displayed
  359. call s:HL('SignColumn', 'none', g:gruvbox_sign_column)
  360. " Line used for closed folds
  361. call s:HL('Folded', 'medium', 'dark1', 'italic')
  362. " Column where folds are displayed
  363. call s:HL('FoldColumn', 'medium', 'dark1')
  364. " }}}
  365. " Cursor: {{{
  366. " Character under cursor
  367. call s:HL('Cursor', 'none', 'none', 'inverse')
  368. " Visual mode cursor, selection
  369. call s:HL('vCursor', 'none', 'none', 'inverse')
  370. " Input moder cursor
  371. call s:HL('iCursor', 'none', 'none', 'inverse')
  372. " Language mapping cursor
  373. call s:HL('lCursor', 'none', 'none', 'inverse')
  374. " }}}
  375. " Syntax Highlighting: {{{
  376. if g:gruvbox_improved_strings == 0
  377. call s:HL('Special', 'orange')
  378. else
  379. call s:HL('Special', 'dark1', 'orange', 'italic')
  380. endif
  381. if g:gruvbox_italicize_comments == 0
  382. call s:HL('Comment', 'medium', 'none')
  383. else
  384. call s:HL('Comment', 'medium', 'none', 'italic')
  385. endif
  386. call s:HL('Todo', 'fg', 'bg', 'bold')
  387. call s:HL('Error', 'bg', 'red', 'bold')
  388. " Generic statement
  389. call s:HL('Statement', 'red')
  390. " if, then, else, endif, swicth, etc.
  391. call s:HL('Conditional', 'red')
  392. " for, do, while, etc.
  393. call s:HL('Repeat', 'red')
  394. " case, default, etc.
  395. call s:HL('Label', 'red')
  396. " try, catch, throw
  397. call s:HL('Exception', 'red')
  398. " sizeof, "+", "*", etc.
  399. hi! link Operator Normal
  400. " Any other keyword
  401. call s:HL('Keyword', 'red')
  402. " Variable name
  403. call s:HL('Identifier', 'blue')
  404. " Function name
  405. call s:HL('Function', 'green', 'none', 'bold')
  406. " Generic preprocessor
  407. call s:HL('PreProc', 'aqua')
  408. " Preprocessor #include
  409. call s:HL('Include', 'aqua')
  410. " Preprocessor #define
  411. call s:HL('Define', 'aqua')
  412. " Same as Define
  413. call s:HL('Macro', 'aqua')
  414. " Preprocessor #if, #else, #endif, etc.
  415. call s:HL('PreCondit', 'aqua')
  416. " Generic constant
  417. call s:HL('Constant', 'purple')
  418. " Character constant: 'c', '/n'
  419. call s:HL('Character', 'purple')
  420. " String constant: "this is a string"
  421. if g:gruvbox_italicize_strings == 0
  422. call s:HL('String', 'green')
  423. else
  424. if g:gruvbox_improved_strings == 0
  425. call s:HL('String', 'green', 'none', 'italic')
  426. else
  427. call s:HL('String', 'dark1', 'light1', 'italic')
  428. endif
  429. endif
  430. " Boolean constant: TRUE, false
  431. call s:HL('Boolean', 'purple')
  432. " Number constant: 234, 0xff
  433. call s:HL('Number', 'purple')
  434. " Floating point constant: 2.3e10
  435. call s:HL('Float', 'purple')
  436. " Generic type
  437. call s:HL('Type', 'yellow')
  438. " static, register, volatile, etc
  439. call s:HL('StorageClass', 'orange')
  440. " struct, union, enum, etc.
  441. call s:HL('Structure', 'aqua')
  442. " typedef
  443. call s:HL('Typedef', 'yellow')
  444. " }}}
  445. " Completion Menu: {{{
  446. if version >= 700
  447. " Popup menu: normal item
  448. call s:HL('Pmenu', 'light1', 'dark2')
  449. " Popup menu: selected item
  450. call s:HL('PmenuSel', 'dark2', 'blue', 'bold')
  451. " Popup menu: scrollbar
  452. call s:HL('PmenuSbar', 'none', 'dark2')
  453. " Popup menu: scrollbar thumb
  454. call s:HL('PmenuThumb', 'none', 'dark4')
  455. endif
  456. " }}}
  457. " Diffs: {{{
  458. call s:HL('DiffDelete', 'dark0', 'red')
  459. call s:HL('DiffAdd', 'dark0', 'green')
  460. "call s:HL('DiffChange', 'dark0', 'blue')
  461. "call s:HL('DiffText', 'dark0', 'yellow')
  462. " Alternative setting
  463. call s:HL('DiffChange', 'dark0', 'aqua')
  464. call s:HL('DiffText', 'dark0', 'yellow')
  465. " }}}
  466. " Spelling: {{{
  467. if has("spell")
  468. " Not capitalised word, or compile warnings
  469. if g:gruvbox_improved_warnings == 0
  470. call s:HL('SpellCap', 'none', 'none', 'undercurl', 'red')
  471. else
  472. call s:HL('SpellCap', 'green', 'none', 'italic,bold')
  473. endif
  474. " Not recognized word
  475. call s:HL('SpellBad', 'none', 'none', 'undercurl', 'blue')
  476. " Wrong spelling for selected region
  477. call s:HL('SpellLocal', 'none', 'none', 'undercurl', 'aqua')
  478. " Rare word
  479. call s:HL('SpellRare', 'none', 'none', 'undercurl', 'purple')
  480. endif
  481. " }}}
  482. " Plugin specific -------------------------------------------------------------
  483. " EasyMotion: {{{
  484. hi! link EasyMotionTarget Search
  485. hi! link EasyMotionShade Comment
  486. " }}}
  487. " Sneak: {{{
  488. hi! link SneakPluginTarget Search
  489. hi! link SneakStreakTarget Search
  490. call s:HL('SneakStreakMask', 'yellow', 'yellow')
  491. hi! link SneakStreakStatusLine Search
  492. " }}}
  493. " Indent Guides: {{{
  494. if !exists('g:indent_guides_auto_colors')
  495. let g:indent_guides_auto_colors = 0
  496. endif
  497. if g:indent_guides_auto_colors == 0
  498. if g:gruvbox_invert_indent_guides == 0
  499. call s:HL('IndentGuidesOdd', 'bg', 'dark2')
  500. call s:HL('IndentGuidesEven', 'bg', 'dark1')
  501. else
  502. call s:HL('IndentGuidesOdd', 'bg', 'dark2', 'inverse')
  503. call s:HL('IndentGuidesEven', 'bg', 'dark3', 'inverse')
  504. endif
  505. endif
  506. " }}}
  507. " IndentLine: {{{
  508. let g:indentLine_color_term = s:gb.dark2[1]
  509. let g:indentLine_color_gui = '#' . s:gb.dark2[0]
  510. " }}}
  511. " Rainbow Parentheses: {{{
  512. if !exists('g:rbpt_colorpairs')
  513. let g:rbpt_colorpairs =
  514. \ [
  515. \ ['blue', '#458588'], ['magenta', '#b16286'],
  516. \ ['red', '#cc241d'], ['166', '#d65d0e']
  517. \ ]
  518. endif
  519. let g:rainbow_guifgs = [ '#d65d0e', '#cc241d', '#b16286', '#458588' ]
  520. let g:rainbow_ctermfgs = [ '166', 'red', 'magenta', 'blue' ]
  521. if !exists('g:rainbow_conf')
  522. let g:rainbow_conf = {}
  523. endif
  524. if !has_key(g:rainbow_conf, 'guifgs')
  525. let g:rainbow_conf['guifgs'] = g:rainbow_guifgs
  526. endif
  527. if !has_key(g:rainbow_conf, 'ctermfgs')
  528. let g:rainbow_conf['ctermfgs'] = g:rainbow_ctermfgs
  529. endif
  530. let g:niji_dark_colours = g:rbpt_colorpairs
  531. let g:niji_light_colours = g:rbpt_colorpairs
  532. "}}}
  533. " GitGutter: {{{
  534. if g:gruvbox_invert_signs == 0
  535. call s:HL('GitGutterAdd', 'green', g:gruvbox_sign_column)
  536. call s:HL('GitGutterChange', 'aqua', g:gruvbox_sign_column)
  537. call s:HL('GitGutterDelete', 'red', g:gruvbox_sign_column)
  538. call s:HL('GitGutterChangeDelete', 'aqua', g:gruvbox_sign_column)
  539. else
  540. call s:HL('GitGutterAdd', 'green', g:gruvbox_sign_column, 'inverse')
  541. call s:HL('GitGutterChange', 'aqua', g:gruvbox_sign_column, 'inverse')
  542. call s:HL('GitGutterDelete', 'red', g:gruvbox_sign_column, 'inverse')
  543. call s:HL('GitGutterChangeDelete', 'aqua', g:gruvbox_sign_column, 'inverse')
  544. endif
  545. " }}}
  546. " gitcommit highlighting "{{{
  547. call s:HL('gitcommitSelectedFile', 'green')
  548. call s:HL('gitcommitDiscardedFile', 'red')
  549. " }}}
  550. " Signify: {{{
  551. if g:gruvbox_invert_signs == 0
  552. call s:HL('SignifySignAdd', 'green', g:gruvbox_sign_column)
  553. call s:HL('SignifySignChange ', 'aqua', g:gruvbox_sign_column)
  554. call s:HL('SignifySignDelete', 'red', g:gruvbox_sign_column)
  555. else
  556. call s:HL('SignifySignAdd', 'green', g:gruvbox_sign_column, 'inverse')
  557. call s:HL('SignifySignChange ', 'aqua', g:gruvbox_sign_column, 'inverse')
  558. call s:HL('SignifySignDelete', 'red', g:gruvbox_sign_column, 'inverse')
  559. endif
  560. " }}}
  561. " Syntastic: {{{
  562. call s:HL('SyntasticError', 'none', 'none', 'undercurl', 'red')
  563. call s:HL('SyntasticWarning', 'none', 'none', 'undercurl', 'yellow')
  564. if g:gruvbox_invert_signs == 0
  565. call s:HL('SyntasticErrorSign', 'red', g:gruvbox_sign_column)
  566. call s:HL('SyntasticWarningSign', 'yellow', g:gruvbox_sign_column)
  567. else
  568. call s:HL('SyntasticErrorSign', 'red', g:gruvbox_sign_column, 'inverse')
  569. call s:HL('SyntasticWarningSign', 'yellow', g:gruvbox_sign_column, 'inverse')
  570. endif
  571. " }}}
  572. " Signature: {{{
  573. if g:gruvbox_invert_signs == 0
  574. call s:HL('SignatureMarkerText', 'purple', g:gruvbox_sign_column)
  575. call s:HL('SignatureMarkText', 'blue', g:gruvbox_sign_column)
  576. else
  577. call s:HL('SignatureMarkerText', 'purple', g:gruvbox_sign_column, 'inverse')
  578. call s:HL('SignatureMarkText', 'blue', g:gruvbox_sign_column, 'inverse')
  579. endif
  580. let g:SignatureMarkerTextHL='"SignatureMarkerText"'
  581. let g:SignatureMarkTextHL='"SignatureMarkText"'
  582. " }}}
  583. " ShowMarks: {{{
  584. if g:gruvbox_invert_signs == 0
  585. call s:HL('ShowMarksHLl', 'blue', g:gruvbox_sign_column)
  586. call s:HL('ShowMarksHLu', 'blue', g:gruvbox_sign_column)
  587. call s:HL('ShowMarksHLo', 'blue', g:gruvbox_sign_column)
  588. call s:HL('ShowMarksHLm', 'blue', g:gruvbox_sign_column)
  589. else
  590. call s:HL('ShowMarksHLl', 'blue', g:gruvbox_sign_column, 'inverse')
  591. call s:HL('ShowMarksHLu', 'blue', g:gruvbox_sign_column, 'inverse')
  592. call s:HL('ShowMarksHLo', 'blue', g:gruvbox_sign_column, 'inverse')
  593. call s:HL('ShowMarksHLm', 'blue', g:gruvbox_sign_column, 'inverse')
  594. endif
  595. " }}}
  596. " CtrlP: {{{
  597. call s:HL('CtrlPMatch', 'yellow')
  598. call s:HL('CtrlPNoEntries', 'red')
  599. call s:HL('CtrlPPrtBase', 'dark2')
  600. call s:HL('CtrlPPrtCursor', 'blue')
  601. call s:HL('CtrlPLinePre', 'dark2')
  602. call s:HL('CtrlPMode1', 'blue', 'dark2', 'bold')
  603. call s:HL('CtrlPMode2', 'dark0', 'blue', 'bold')
  604. call s:HL('CtrlPStats', 'light4', 'dark2', 'bold')
  605. " }}}
  606. " Startify: {{{
  607. call s:HL('StartifyBracket', 'light3')
  608. call s:HL('StartifyFile', 'light0')
  609. call s:HL('StartifyNumber', 'blue')
  610. call s:HL('StartifyPath', 'medium')
  611. call s:HL('StartifySlash', 'medium')
  612. call s:HL('StartifySection', 'yellow')
  613. call s:HL('StartifySpecial', 'dark2')
  614. call s:HL('StartifyHeader', 'orange')
  615. call s:HL('StartifyFooter', 'dark2')
  616. " }}}
  617. " Vimshell: {{{
  618. let g:vimshell_escape_colors = map(split(
  619. \ 'dark4 red green yellow blue purple aqua light4 ' .
  620. \ 'dark0 red green orange blue purple aqua light0'
  621. \ ), '"#" . s:gb[v:val][0]')
  622. " }}}
  623. " Filetype specific -----------------------------------------------------------
  624. " Diff: {{{
  625. call s:HL('diffAdded', 'green')
  626. call s:HL('diffRemoved', 'red')
  627. call s:HL('diffChanged', 'aqua')
  628. call s:HL('diffFile', 'orange')
  629. call s:HL('diffNewFile', 'yellow')
  630. call s:HL('diffLine', 'blue')
  631. " }}}
  632. " Html: {{{
  633. call s:HL('htmlTag', 'blue')
  634. call s:HL('htmlEndTag', 'blue')
  635. call s:HL('htmlTagName', 'aqua', 'none', 'bold')
  636. call s:HL('htmlArg', 'aqua')
  637. call s:HL('htmlScriptTag', 'purple')
  638. call s:HL('htmlTagN', 'light1')
  639. call s:HL('htmlSpecialTagName', 'aqua', 'none', 'bold')
  640. call s:HL('htmlLink', 'light4', 'none', 'underline')
  641. call s:HL('htmlSpecialChar', 'orange')
  642. call s:HL('htmlBold', 'fg', 'bg', 'bold')
  643. call s:HL('htmlBoldUnderline', 'fg', 'bg', 'bold,underline')
  644. call s:HL('htmlBoldItalic', 'fg', 'bg', 'bold,italic')
  645. call s:HL('htmlBoldUnderlineItalic', 'fg', 'bg', 'bold,underline,italic')
  646. call s:HL('htmlUnderline', 'fg', 'bg', 'underline')
  647. call s:HL('htmlUnderlineItalic', 'fg', 'bg', 'underline,italic')
  648. call s:HL('htmlItalic', 'fg', 'bg', 'italic')
  649. " }}}
  650. " Xml: {{{
  651. call s:HL('xmlTag', 'blue')
  652. call s:HL('xmlEndTag', 'blue')
  653. call s:HL('xmlTagName', 'blue')
  654. call s:HL('xmlEqual', 'blue')
  655. call s:HL('docbkKeyword', 'aqua', 'none', 'bold')
  656. call s:HL('xmlDocTypeDecl', 'medium')
  657. call s:HL('xmlDocTypeKeyword', 'purple')
  658. call s:HL('xmlCdataStart', 'medium')
  659. call s:HL('xmlCdataCdata', 'purple')
  660. call s:HL('dtdFunction', 'medium')
  661. call s:HL('dtdTagName', 'purple')
  662. call s:HL('xmlAttrib', 'aqua')
  663. call s:HL('xmlProcessingDelim', 'medium')
  664. call s:HL('dtdParamEntityPunct', 'medium')
  665. call s:HL('dtdParamEntityDPunct', 'medium')
  666. call s:HL('xmlAttribPunct', 'medium')
  667. call s:HL('xmlEntity', 'orange')
  668. call s:HL('xmlEntityPunct', 'orange')
  669. " }}}
  670. " Vim: {{{
  671. if g:gruvbox_italicize_comments == 0
  672. call s:HL('vimCommentTitle', 'light4_256', 'none', 'bold')
  673. else
  674. call s:HL('vimCommentTitle', 'light4_256', 'none', 'bold,italic')
  675. endif
  676. call s:HL('vimNotation', 'orange')
  677. call s:HL('vimBracket', 'orange')
  678. call s:HL('vimMapModKey', 'orange')
  679. call s:HL('vimFuncSID', 'light3')
  680. call s:HL('vimSetSep', 'light3')
  681. call s:HL('vimSep', 'light3')
  682. call s:HL('vimContinue', 'light3')
  683. " }}}
  684. " Clojure: {{{
  685. call s:HL('clojureKeyword', 'blue')
  686. call s:HL('clojureCond', 'orange')
  687. call s:HL('clojureSpecial', 'orange')
  688. call s:HL('clojureDefine', 'orange')
  689. call s:HL('clojureFunc', 'yellow')
  690. call s:HL('clojureRepeat', 'yellow')
  691. call s:HL('clojureCharacter', 'aqua')
  692. call s:HL('clojureStringEscape', 'aqua')
  693. call s:HL('clojureException', 'red')
  694. call s:HL('clojureRegexp', 'aqua')
  695. call s:HL('clojureRegexpEscape', 'aqua')
  696. call s:HL('clojureRegexpCharClass', 'light3', 'none', 'bold')
  697. call s:HL('clojureRegexpMod', 'light3', 'none', 'bold')
  698. call s:HL('clojureRegexpQuantifier', 'light3', 'none', 'bold')
  699. call s:HL('clojureParen', 'light3')
  700. call s:HL('clojureAnonArg', 'yellow')
  701. call s:HL('clojureVariable', 'blue')
  702. call s:HL('clojureMacro', 'orange')
  703. call s:HL('clojureMeta', 'yellow')
  704. call s:HL('clojureDeref', 'yellow')
  705. call s:HL('clojureQuote', 'yellow')
  706. call s:HL('clojureUnquote', 'yellow')
  707. " }}}
  708. " C: {{{
  709. call s:HL('cOperator', 'purple')
  710. call s:HL('cStructure', 'orange')
  711. " }}}
  712. " Python: {{{
  713. call s:HL('pythonBuiltin', 'orange')
  714. call s:HL('pythonBuiltinObj', 'orange')
  715. call s:HL('pythonBuiltinFunc', 'orange')
  716. call s:HL('pythonFunction', 'aqua')
  717. call s:HL('pythonDecorator', 'red')
  718. call s:HL('pythonInclude', 'blue')
  719. call s:HL('pythonImport', 'blue')
  720. call s:HL('pythonRun', 'blue')
  721. call s:HL('pythonCoding', 'blue')
  722. call s:HL('pythonOperator', 'red')
  723. call s:HL('pythonExceptions', 'purple')
  724. call s:HL('pythonBoolean', 'purple')
  725. call s:HL('pythonDot', 'light3')
  726. " }}}
  727. " CSS: {{{
  728. call s:HL('cssBraces', 'blue')
  729. call s:HL('cssFunctionName', 'yellow')
  730. call s:HL('cssIdentifier', 'orange')
  731. call s:HL('cssClassName', 'green')
  732. call s:HL('cssColor', 'blue')
  733. call s:HL('cssSelectorOp', 'blue')
  734. call s:HL('cssSelectorOp2', 'blue')
  735. call s:HL('cssImportant', 'green')
  736. call s:HL('cssVendor', 'light1')
  737. call s:HL('cssTextProp', 'aqua')
  738. call s:HL('cssAnimationProp', 'aqua')
  739. call s:HL('cssUIProp', 'yellow')
  740. call s:HL('cssTransformProp', 'aqua')
  741. call s:HL('cssTransitionProp', 'aqua')
  742. call s:HL('cssPrintProp', 'aqua')
  743. call s:HL('cssPositioningProp', 'yellow')
  744. call s:HL('cssBoxProp', 'aqua')
  745. call s:HL('cssFontDescriptorProp', 'aqua')
  746. call s:HL('cssFlexibleBoxProp', 'aqua')
  747. call s:HL('cssBorderOutlineProp', 'aqua')
  748. call s:HL('cssBackgroundProp', 'aqua')
  749. call s:HL('cssMarginProp', 'aqua')
  750. call s:HL('cssListProp', 'aqua')
  751. call s:HL('cssTableProp', 'aqua')
  752. call s:HL('cssFontProp', 'aqua')
  753. call s:HL('cssPaddingProp', 'aqua')
  754. call s:HL('cssDimensionProp', 'aqua')
  755. call s:HL('cssRenderProp', 'aqua')
  756. call s:HL('cssColorProp', 'aqua')
  757. call s:HL('cssGeneratedContentProp', 'aqua')
  758. " }}}
  759. " JavaScript: {{{
  760. call s:HL('javaScriptBraces', 'orange')
  761. call s:HL('javaScriptFunction', 'aqua')
  762. call s:HL('javaScriptIdentifier', 'red')
  763. call s:HL('javaScriptMember', 'blue')
  764. call s:HL('javaScriptNumber', 'purple')
  765. call s:HL('javaScriptNull', 'purple')
  766. call s:HL('javaScriptParens', 'light3')
  767. " }}}
  768. " CoffeeScript: {{{
  769. call s:HL('coffeeExtendedOp', 'light3')
  770. call s:HL('coffeeSpecialOp', 'light3')
  771. call s:HL('coffeeCurly', 'orange')
  772. call s:HL('coffeeParen', 'light3')
  773. call s:HL('coffeeBracket', 'orange')
  774. " }}}
  775. " Ruby: {{{
  776. call s:HL('rubyStringDelimiter', 'green')
  777. call s:HL('rubyInterpolationDelimiter', 'aqua')
  778. " }}}
  779. " ObjectiveC: {{{
  780. call s:HL('objcTypeModifier', 'red')
  781. call s:HL('objcDirective', 'blue')
  782. " }}}
  783. " Go: {{{
  784. call s:HL('goDirective', 'aqua')
  785. call s:HL('goConstants', 'purple')
  786. call s:HL('goDeclaration', 'red')
  787. call s:HL('goDeclType', 'blue')
  788. call s:HL('goBuiltins', 'orange')
  789. " }}}
  790. " Lua: {{{
  791. call s:HL('luaIn', 'red')
  792. call s:HL('luaFunction', 'aqua')
  793. call s:HL('luaTable', 'orange')
  794. " }}}
  795. " MoonScript: {{{
  796. call s:HL('moonSpecialOp', 'light3')
  797. call s:HL('moonExtendedOp', 'light3')
  798. call s:HL('moonFunction', 'light3')
  799. call s:HL('moonObject', 'yellow')
  800. " }}}
  801. " Java: {{{
  802. call s:HL('javaAnnotation', 'blue')
  803. call s:HL('javaDocTags', 'aqua')
  804. hi! link javaCommentTitle vimCommentTitle
  805. call s:HL('javaParen', 'light3')
  806. call s:HL('javaParen1', 'light3')
  807. call s:HL('javaParen2', 'light3')
  808. call s:HL('javaParen3', 'light3')
  809. call s:HL('javaParen4', 'light3')
  810. call s:HL('javaParen5', 'light3')
  811. call s:HL('javaOperator', 'orange')
  812. call s:HL('javaVarArg', 'green')
  813. " }}}
  814. " Elixir: {{{
  815. hi! link elixirDocString Comment
  816. call s:HL('elixirStringDelimiter', 'green')
  817. call s:HL('elixirInterpolationDelimiter', 'aqua')
  818. " }}}
  819. " Scala: {{{
  820. " NB: scala vim syntax file is kinda horrible
  821. call s:HL('scalaNameDefinition', 'light1')
  822. call s:HL('scalaCaseFollowing', 'light1')
  823. call s:HL('scalaCapitalWord', 'light1')
  824. call s:HL('scalaTypeExtension', 'light1')
  825. call s:HL('scalaKeyword', 'red')
  826. call s:HL('scalaKeywordModifier', 'red')
  827. call s:HL('scalaSpecial', 'aqua')
  828. call s:HL('scalaOperator', 'light1')
  829. call s:HL('scalaTypeDeclaration', 'yellow')
  830. call s:HL('scalaTypeTypePostDeclaration', 'yellow')
  831. call s:HL('scalaInstanceDeclaration', 'light1')
  832. call s:HL('scalaInterpolation', 'aqua')
  833. " }}}
  834. " Markdown: {{{
  835. call s:HL('markdownItalic', 'light3', 'none', 'italic')
  836. call s:HL('markdownH1', 'green', 'none', 'bold')
  837. call s:HL('markdownH2', 'green', 'none', 'bold')
  838. call s:HL('markdownH3', 'yellow', 'none', 'bold')
  839. call s:HL('markdownH4', 'yellow', 'none', 'bold')
  840. call s:HL('markdownH5', 'yellow')
  841. call s:HL('markdownH6', 'yellow')
  842. call s:HL('markdownCode', 'aqua')
  843. call s:HL('markdownCodeBlock', 'aqua')
  844. call s:HL('markdownCodeDelimiter', 'aqua')
  845. call s:HL('markdownBlockquote', 'medium')
  846. call s:HL('markdownListMarker', 'medium')
  847. call s:HL('markdownOrderedListMarker', 'medium')
  848. call s:HL('markdownRule', 'medium')
  849. call s:HL('markdownHeadingRule', 'medium')
  850. call s:HL('markdownUrlDelimiter', 'light3')
  851. call s:HL('markdownLinkDelimiter', 'light3')
  852. call s:HL('markdownLinkTextDelimiter', 'light3')
  853. call s:HL('markdownHeadingDelimiter', 'orange')
  854. call s:HL('markdownUrl', 'purple')
  855. call s:HL('markdownUrlTitleDelimiter', 'green')
  856. call s:HL('markdownLinkText', 'medium', 'none', 'underline')
  857. call s:HL('markdownIdDeclaration', 'medium', 'none', 'underline')
  858. " }}}
  859. " Functions -------------------------------------------------------------------
  860. " Search Highlighting Cursor {{{
  861. function! GruvboxHlsShowCursor()
  862. call s:HL('Cursor', 'dark0', g:gruvbox_hls_cursor)
  863. call s:HL('vCursor', 'dark0', g:gruvbox_hls_cursor)
  864. call s:HL('iCursor', 'dark0', g:gruvbox_hls_cursor)
  865. call s:HL('lCursor', 'dark0', g:gruvbox_hls_cursor)
  866. endfunction
  867. function! GruvboxHlsHideCursor()
  868. call s:HL('Cursor', 'none', 'none', 'inverse')
  869. call s:HL('vCursor', 'none', 'none', 'inverse')
  870. call s:HL('iCursor', 'none', 'none', 'inverse')
  871. call s:HL('lCursor', 'none', 'none', 'inverse')
  872. endfunction
  873. " }}}
  874. " vim: set sw=3 ts=3 sts=3 noet tw=80 ft=vim fdm=marker: