init.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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}
  55. }
  56. }
  57. print(vim.fn.getbufvar(0,'ts'))
  58. vim.fn.getbufvar(0,'ts')
  59. gls.left[2] = {
  60. GitIcon = {
  61. provider = function()
  62. return ' '
  63. end,
  64. condition = condition.check_git_workspace,
  65. separator = ' ',
  66. separator_highlight = {'NONE', colors.bg},
  67. highlight = {colors.orange, colors.bg}
  68. }
  69. }
  70. gls.left[3] = {
  71. GitBranch = {
  72. provider = 'GitBranch',
  73. condition = condition.check_git_workspace,
  74. separator = ' ',
  75. separator_highlight = {'NONE', colors.bg},
  76. highlight = {colors.grey, colors.bg}
  77. }
  78. }
  79. gls.left[4] = {
  80. DiffAdd = {
  81. provider = 'DiffAdd',
  82. condition = condition.hide_in_width,
  83. icon = '  ',
  84. highlight = {colors.green, colors.bg}
  85. }
  86. }
  87. gls.left[5] = {
  88. DiffModified = {
  89. provider = 'DiffModified',
  90. condition = condition.hide_in_width,
  91. icon = ' 柳',
  92. highlight = {colors.blue, colors.bg}
  93. }
  94. }
  95. gls.left[6] = {
  96. DiffRemove = {
  97. provider = 'DiffRemove',
  98. condition = condition.hide_in_width,
  99. icon = '  ',
  100. highlight = {colors.red, colors.bg}
  101. }
  102. }
  103. gls.right[1] = {
  104. DiagnosticError = {
  105. provider = 'DiagnosticError',
  106. icon = '  ',
  107. highlight = {colors.error_red, colors.bg}
  108. }
  109. }
  110. gls.right[2] = {
  111. DiagnosticWarn = {
  112. provider = 'DiagnosticWarn',
  113. icon = '  ',
  114. highlight = {colors.orange, colors.bg}
  115. }
  116. }
  117. gls.right[3] = {
  118. DiagnosticHint = {
  119. provider = 'DiagnosticHint',
  120. icon = '  ',
  121. highlight = {colors.blue, colors.bg}
  122. }
  123. }
  124. gls.right[4] = {
  125. DiagnosticInfo = {
  126. provider = 'DiagnosticInfo',
  127. icon = '  ',
  128. highlight = {colors.blue, colors.bg}
  129. }
  130. }
  131. gls.right[5] = {
  132. ShowLspClient = {
  133. provider = 'GetLspClient',
  134. condition = function()
  135. local tbl = {['dashboard'] = true, [' '] = true}
  136. if tbl[vim.bo.filetype] then return false end
  137. return true
  138. end,
  139. icon = ' ',
  140. highlight = {colors.grey, colors.bg}
  141. }
  142. }
  143. gls.right[6] = {
  144. LineInfo = {
  145. provider = 'LineColumn',
  146. separator = ' ',
  147. separator_highlight = {'NONE', colors.bg},
  148. highlight = {colors.grey, colors.bg}
  149. }
  150. }
  151. gls.right[7] = {
  152. PerCent = {
  153. provider = 'LinePercent',
  154. separator = ' ',
  155. separator_highlight = {'NONE', colors.bg},
  156. highlight = {colors.grey, colors.bg}
  157. }
  158. }
  159. gls.right[8] = {
  160. Tabstop = {
  161. provider = function()
  162. return "Spaces: " .. vim.api.nvim_buf_get_option(0, "tabstop") .. " "
  163. end,
  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[9] = {
  171. BufferType = {
  172. provider = 'FileTypeName',
  173. condition = condition.hide_in_width,
  174. separator = ' ',
  175. separator_highlight = {'NONE', colors.bg},
  176. highlight = {colors.grey, colors.bg}
  177. }
  178. }
  179. gls.right[10] = {
  180. FileEncode = {
  181. provider = 'FileEncode',
  182. condition = condition.hide_in_width,
  183. separator = ' ',
  184. separator_highlight = {'NONE',colors.bg},
  185. highlight = {colors.grey, colors.bg}
  186. }
  187. }
  188. gls.right[11] = {
  189. Space = {
  190. provider = function()
  191. return ' '
  192. end,
  193. separator = ' ',
  194. separator_highlight = {'NONE', colors.bg},
  195. highlight = {colors.orange, colors.bg}
  196. }
  197. }
  198. gls.short_line_left[1] = {
  199. BufferType = {
  200. provider = 'FileTypeName',
  201. separator = ' ',
  202. separator_highlight = {'NONE', colors.bg},
  203. highlight = {colors.grey, colors.bg}
  204. }
  205. }
  206. gls.short_line_left[2] = {
  207. SFileName = {
  208. provider = 'SFileName',
  209. condition = condition.buffer_not_empty,
  210. highlight = {colors.grey, colors.bg}
  211. }
  212. }
  213. gls.short_line_right[1] = {
  214. BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}
  215. }