init.lua 4.4 KB

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