init.lua 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. local gl = require('galaxyline')
  2. -- get my theme in galaxyline repo
  3. -- local colors = require('galaxyline.theme').default
  4. local colors = {
  5. bg = '#2E2E2E',
  6. yellow = '#DCDCAA',
  7. dark_yellow = '#D7BA7D',
  8. cyan = '#4EC9B0',
  9. green = '#608B4E',
  10. light_green = '#B5CEA8',
  11. string_orange = '#CE9178',
  12. orange = '#FF8800',
  13. purple = '#C586C0',
  14. magenta = '#D16D9E',
  15. grey = '#858585',
  16. blue = '#569CD6',
  17. vivid_blue = '#4FC1FF',
  18. light_blue = '#9CDCFE',
  19. red = '#D16969',
  20. error_red = '#F44747'
  21. }
  22. local condition = require('galaxyline.condition')
  23. local gls = gl.section
  24. gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
  25. gls.left[1] = {
  26. ViMode = {
  27. provider = function()
  28. -- auto change color according the vim mode
  29. local mode_color = {
  30. n = colors.blue,
  31. i = colors.green,
  32. v = colors.purple,
  33. [''] = colors.purple,
  34. V = colors.purple,
  35. c = colors.magenta,
  36. no = colors.blue,
  37. s = colors.orange,
  38. S = colors.orange,
  39. [''] = colors.orange,
  40. ic = colors.yellow,
  41. R = colors.red,
  42. Rv = colors.red,
  43. cv = colors.blue,
  44. ce = colors.blue,
  45. r = colors.cyan,
  46. rm = colors.cyan,
  47. ['r?'] = colors.cyan,
  48. ['!'] = colors.blue,
  49. t = colors.blue
  50. }
  51. vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
  52. return '▊ '
  53. end,
  54. highlight = {colors.red, colors.bg, 'bold'}
  55. }
  56. }
  57. gls.left[2] = {
  58. GitIcon = {
  59. provider = function()
  60. return ' '
  61. end,
  62. condition = condition.check_git_workspace,
  63. separator = ' ',
  64. separator_highlight = {'NONE', colors.bg},
  65. highlight = {colors.orange, colors.bg, 'bold'}
  66. }
  67. }
  68. gls.left[3] = {
  69. GitBranch = {
  70. provider = 'GitBranch',
  71. condition = condition.check_git_workspace,
  72. separator = ' ',
  73. separator_highlight = {'NONE', colors.bg},
  74. highlight = {colors.grey, colors.bg, 'bold'}
  75. }
  76. }
  77. gls.left[4] = {
  78. DiffAdd = {
  79. provider = 'DiffAdd',
  80. condition = condition.hide_in_width,
  81. icon = '  ',
  82. highlight = {colors.green, colors.bg}
  83. }
  84. }
  85. gls.left[5] = {
  86. DiffModified = {
  87. provider = 'DiffModified',
  88. condition = condition.hide_in_width,
  89. icon = ' 柳',
  90. highlight = {colors.blue, colors.bg}
  91. }
  92. }
  93. gls.left[6] = {
  94. DiffRemove = {
  95. provider = 'DiffRemove',
  96. condition = condition.hide_in_width,
  97. icon = '  ',
  98. highlight = {colors.red, colors.bg}
  99. }
  100. }
  101. gls.right[1] = {
  102. DiagnosticError = {
  103. provider = 'DiagnosticError',
  104. icon = '  ',
  105. highlight = {colors.error_red, colors.bg}
  106. }
  107. }
  108. gls.right[2] = {
  109. DiagnosticWarn = {
  110. provider = 'DiagnosticWarn',
  111. icon = '  ',
  112. highlight = {colors.orange, colors.bg}
  113. }
  114. }
  115. gls.right[3] = {
  116. DiagnosticHint = {
  117. provider = 'DiagnosticHint',
  118. icon = '  ',
  119. highlight = {colors.blue, colors.bg}
  120. }
  121. }
  122. gls.right[4] = {
  123. DiagnosticInfo = {
  124. provider = 'DiagnosticInfo',
  125. icon = '  ',
  126. highlight = {colors.blue, colors.bg}
  127. }
  128. }
  129. gls.right[5] = {
  130. ShowLspClient = {
  131. provider = 'GetLspClient',
  132. condition = function()
  133. local tbl = {['dashboard'] = true, [' '] = true}
  134. if tbl[vim.bo.filetype] then return false end
  135. return true
  136. end,
  137. icon = ' ',
  138. highlight = {colors.grey, colors.bg, 'bold'}
  139. }
  140. }
  141. gls.right[6] = {
  142. LineInfo = {
  143. provider = 'LineColumn',
  144. separator = ' ',
  145. separator_highlight = {'NONE', colors.bg},
  146. highlight = {colors.grey, colors.bg}
  147. }
  148. }
  149. gls.right[7] = {
  150. PerCent = {
  151. provider = 'LinePercent',
  152. separator = ' ',
  153. separator_highlight = {'NONE', colors.bg},
  154. highlight = {colors.grey, colors.bg, 'bold'}
  155. }
  156. }
  157. gls.short_line_left[1] = {
  158. BufferType = {
  159. provider = 'FileTypeName',
  160. separator = ' ',
  161. separator_highlight = {'NONE', colors.bg},
  162. highlight = {colors.grey, colors.bg, 'bold'}
  163. }
  164. }
  165. gls.short_line_left[2] = {
  166. SFileName = {
  167. provider = 'SFileName',
  168. condition = condition.buffer_not_empty,
  169. highlight = {colors.grey, colors.bg, 'bold'}
  170. }
  171. }
  172. gls.short_line_right[1] = {
  173. BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}
  174. }