init.lua 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. -- galaxyline themes for Gruvbox and NVCode.
  25. -- Uncomment and change 'colors_colorschemeName'
  26. -- to 'colors' to enable.
  27. -- Colors for Gruvbox
  28. -- local colors_gruvbox = {
  29. -- bg = '#32302F',
  30. -- yellow = '#FABD2F',
  31. -- dark_yellow = '#D79921',
  32. -- cyan = '#689D6A',
  33. -- green = '#608B4E',
  34. -- light_green = '#B8BB26',
  35. -- string_orange = '#D65D0E',
  36. -- orange = '#FE8019',
  37. -- purple = '#B16286',
  38. -- magenta = '#D3869B',
  39. -- grey = '#A89984',
  40. -- blue = '#458588',
  41. -- -- vivid_blue = '#4FC1FF',
  42. -- light_blue = '#83A598',
  43. -- red = '#FB4834',
  44. -- error_red = '#CC241D',
  45. -- info_yellow = '#D79921'
  46. -- }
  47. -- colors for NVCode theme (very minimal changes)
  48. -- local colors_nvcode = {
  49. -- bg = '#2E2E2E',
  50. -- yellow = '#DCDCAA',
  51. -- dark_yellow = '#D7BA7D',
  52. -- cyan = '#4EC9B0',
  53. -- green = '#608B4E',
  54. -- light_green = '#B5CEA8',
  55. -- string_orange = '#CE9178',
  56. -- orange = '#FF8800',
  57. -- purple = '#C586C0',
  58. -- magenta = '#D16D9E',
  59. -- grey = '#729CB3',
  60. -- blue = '#569CD6',
  61. -- vivid_blue = '#4FC1FF',
  62. -- light_blue = '#9CDCFE',
  63. -- red = '#D16969',
  64. -- error_red = '#F44747',
  65. -- info_yellow = '#FFCC66'
  66. -- }
  67. local condition = require('galaxyline.condition')
  68. local gls = gl.section
  69. gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
  70. table.insert(gls.left, {
  71. ViMode = {
  72. provider = function()
  73. -- auto change color according the vim mode
  74. local mode_color = {
  75. n = colors.blue,
  76. i = colors.green,
  77. v = colors.purple,
  78. [''] = colors.purple,
  79. V = colors.purple,
  80. c = colors.magenta,
  81. no = colors.blue,
  82. s = colors.orange,
  83. S = colors.orange,
  84. [''] = colors.orange,
  85. ic = colors.yellow,
  86. R = colors.red,
  87. Rv = colors.red,
  88. cv = colors.blue,
  89. ce = colors.blue,
  90. r = colors.cyan,
  91. rm = colors.cyan,
  92. ['r?'] = colors.cyan,
  93. ['!'] = colors.blue,
  94. t = colors.blue
  95. }
  96. vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
  97. return '▊ '
  98. end,
  99. highlight = {colors.red, colors.bg}
  100. }
  101. })
  102. print(vim.fn.getbufvar(0, 'ts'))
  103. vim.fn.getbufvar(0, 'ts')
  104. table.insert(gls.left, {
  105. GitIcon = {
  106. provider = function()
  107. return ' '
  108. end,
  109. condition = condition.check_git_workspace,
  110. separator = ' ',
  111. separator_highlight = {'NONE', colors.bg},
  112. highlight = {colors.orange, colors.bg}
  113. }
  114. })
  115. table.insert(gls.left, {
  116. GitBranch = {
  117. provider = 'GitBranch',
  118. condition = condition.check_git_workspace,
  119. separator = ' ',
  120. separator_highlight = {'NONE', colors.bg},
  121. highlight = {colors.grey, colors.bg}
  122. }
  123. })
  124. table.insert(gls.left, {
  125. DiffAdd = {
  126. provider = 'DiffAdd',
  127. condition = condition.hide_in_width,
  128. icon = '  ',
  129. highlight = {colors.green, colors.bg}
  130. }
  131. })
  132. table.insert(gls.left, {
  133. DiffModified = {
  134. provider = 'DiffModified',
  135. condition = condition.hide_in_width,
  136. icon = ' 柳',
  137. highlight = {colors.blue, colors.bg}
  138. }
  139. })
  140. table.insert(gls.left, {
  141. DiffRemove = {
  142. provider = 'DiffRemove',
  143. condition = condition.hide_in_width,
  144. icon = '  ',
  145. highlight = {colors.red, colors.bg}
  146. }
  147. })
  148. table.insert(gls.right, {
  149. DiagnosticError = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}}
  150. })
  151. table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}})
  152. table.insert(gls.right, {
  153. DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.vivid_blue, colors.bg}}
  154. })
  155. table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}})
  156. table.insert(gls.right, {
  157. TreesitterIcon = {
  158. provider = function()
  159. if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end
  160. return ''
  161. end,
  162. separator = ' ',
  163. separator_highlight = {'NONE', colors.bg},
  164. highlight = {colors.green, colors.bg}
  165. }
  166. })
  167. table.insert(gls.right, {
  168. ShowLspClient = {
  169. provider = 'GetLspClient',
  170. condition = function()
  171. local tbl = {['dashboard'] = true, [' '] = true}
  172. if tbl[vim.bo.filetype] then return false end
  173. return true
  174. end,
  175. icon = ' ',
  176. highlight = {colors.grey, colors.bg}
  177. }
  178. })
  179. table.insert(gls.right, {
  180. LineInfo = {
  181. provider = 'LineColumn',
  182. separator = ' ',
  183. separator_highlight = {'NONE', colors.bg},
  184. highlight = {colors.grey, colors.bg}
  185. }
  186. })
  187. table.insert(gls.right, {
  188. PerCent = {
  189. provider = 'LinePercent',
  190. separator = ' ',
  191. separator_highlight = {'NONE', colors.bg},
  192. highlight = {colors.grey, colors.bg}
  193. }
  194. })
  195. table.insert(gls.right, {
  196. Tabstop = {
  197. provider = function()
  198. return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
  199. end,
  200. condition = condition.hide_in_width,
  201. separator = ' ',
  202. separator_highlight = {'NONE', colors.bg},
  203. highlight = {colors.grey, colors.bg}
  204. }
  205. })
  206. table.insert(gls.right, {
  207. BufferType = {
  208. provider = 'FileTypeName',
  209. condition = condition.hide_in_width,
  210. separator = ' ',
  211. separator_highlight = {'NONE', colors.bg},
  212. highlight = {colors.grey, colors.bg}
  213. }
  214. })
  215. table.insert(gls.right, {
  216. FileEncode = {
  217. provider = 'FileEncode',
  218. condition = condition.hide_in_width,
  219. separator = ' ',
  220. separator_highlight = {'NONE', colors.bg},
  221. highlight = {colors.grey, colors.bg}
  222. }
  223. })
  224. table.insert(gls.right, {
  225. Space = {
  226. provider = function()
  227. return ' '
  228. end,
  229. separator = ' ',
  230. separator_highlight = {'NONE', colors.bg},
  231. highlight = {colors.orange, colors.bg}
  232. }
  233. })
  234. table.insert(gls.short_line_left, {
  235. BufferType = {
  236. provider = 'FileTypeName',
  237. separator = ' ',
  238. separator_highlight = {'NONE', colors.bg},
  239. highlight = {colors.grey, colors.bg}
  240. }
  241. })
  242. table.insert(gls.short_line_left, {
  243. SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}}
  244. })
  245. --table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}})