init.lua 5.5 KB

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