init.lua 5.6 KB

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