init.lua 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}}
  105. }
  106. gls.right[2] = {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}}
  107. gls.right[3] = {DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.blue, colors.bg}}}
  108. gls.right[4] = {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.blue, colors.bg}}}
  109. gls.right[5] = {
  110. ShowLspClient = {
  111. provider = 'GetLspClient',
  112. condition = function()
  113. local tbl = {['dashboard'] = true, [' '] = true}
  114. if tbl[vim.bo.filetype] then return false end
  115. return true
  116. end,
  117. icon = ' ',
  118. highlight = {colors.grey, colors.bg}
  119. }
  120. }
  121. gls.right[6] = {
  122. LineInfo = {
  123. provider = 'LineColumn',
  124. separator = ' ',
  125. separator_highlight = {'NONE', colors.bg},
  126. highlight = {colors.grey, colors.bg}
  127. }
  128. }
  129. gls.right[7] = {
  130. PerCent = {
  131. provider = 'LinePercent',
  132. separator = ' ',
  133. separator_highlight = {'NONE', colors.bg},
  134. highlight = {colors.grey, colors.bg}
  135. }
  136. }
  137. gls.right[8] = {
  138. Tabstop = {
  139. provider = function()
  140. return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
  141. end,
  142. condition = condition.hide_in_width,
  143. separator = ' ',
  144. separator_highlight = {'NONE', colors.bg},
  145. highlight = {colors.grey, colors.bg}
  146. }
  147. }
  148. gls.right[9] = {
  149. BufferType = {
  150. provider = 'FileTypeName',
  151. condition = condition.hide_in_width,
  152. separator = ' ',
  153. separator_highlight = {'NONE', colors.bg},
  154. highlight = {colors.grey, colors.bg}
  155. }
  156. }
  157. gls.right[10] = {
  158. FileEncode = {
  159. provider = 'FileEncode',
  160. condition = condition.hide_in_width,
  161. separator = ' ',
  162. separator_highlight = {'NONE', colors.bg},
  163. highlight = {colors.grey, colors.bg}
  164. }
  165. }
  166. gls.right[11] = {
  167. Space = {
  168. provider = function()
  169. return ' '
  170. end,
  171. separator = ' ',
  172. separator_highlight = {'NONE', colors.bg},
  173. highlight = {colors.orange, colors.bg}
  174. }
  175. }
  176. gls.short_line_left[1] = {
  177. BufferType = {
  178. provider = 'FileTypeName',
  179. separator = ' ',
  180. separator_highlight = {'NONE', colors.bg},
  181. highlight = {colors.grey, colors.bg}
  182. }
  183. }
  184. gls.short_line_left[2] = {
  185. SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}}
  186. }
  187. gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}}