init.lua 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. -- require'nvim-web-devicons'.setup()
  2. local gl = require('galaxyline')
  3. local gls = gl.section
  4. gl.short_line_list = {'LuaTree','vista','dbui'}
  5. local colors = {
  6. bg = '#282c34',
  7. yellow = '#fabd2f',
  8. cyan = '#008080',
  9. darkblue = '#081633',
  10. green = '#608B4E',
  11. orange = '#FF8800',
  12. purple = '#5d4d7a',
  13. magenta = '#d16d9e',
  14. grey = '#c0c0c0',
  15. blue = '#569CD6',
  16. red = '#D16969'
  17. }
  18. local buffer_not_empty = function()
  19. if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then
  20. return true
  21. end
  22. return false
  23. end
  24. gls.left[2] = {
  25. ViMode = {
  26. provider = function()
  27. -- auto change color according the vim mode
  28. local mode_color = {n = colors.purple,
  29. i = colors.green,
  30. v = colors.blue,
  31. [''] = colors.blue,
  32. V = colors.blue,
  33. c = colors.purple,
  34. no = colors.magenta,
  35. s = colors.orange,
  36. S = colors.orange,
  37. [''] = colors.orange,
  38. ic = colors.yellow,
  39. R = colors.red,
  40. Rv = colors.red,
  41. cv = colors.red,
  42. ce=colors.red,
  43. r = colors.cyan,
  44. rm = colors.cyan,
  45. ['r?'] = colors.cyan,
  46. ['!'] = colors.red,
  47. t = colors.red}
  48. vim.api.nvim_command('hi GalaxyViMode guibg='..mode_color[vim.fn.mode()])
  49. return ' NVCode '
  50. end,
  51. separator = ' ',
  52. separator_highlight = {colors.yellow,function()
  53. if not buffer_not_empty() then
  54. return colors.bg
  55. end
  56. return colors.bg
  57. end},
  58. highlight = {colors.grey,colors.bg,'bold'},
  59. },
  60. }
  61. -- gls.left[3] ={
  62. -- FileIcon = {
  63. -- separator = ' ',
  64. -- provider = 'FileIcon',
  65. -- condition = buffer_not_empty,
  66. -- highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg},
  67. -- },
  68. -- }
  69. -- gls.left[4] = {
  70. -- FileName = {
  71. -- provider = {'FileSize'},
  72. -- condition = buffer_not_empty,
  73. -- separator = ' ',
  74. -- separator_highlight = {colors.purple,colors.bg},
  75. -- highlight = {colors.magenta,colors.bg}
  76. -- }
  77. -- }
  78. gls.left[3] = {
  79. GitIcon = {
  80. provider = function() return ' ' end,
  81. condition = buffer_not_empty,
  82. highlight = {colors.orange,colors.bg},
  83. }
  84. }
  85. gls.left[4] = {
  86. GitBranch = {
  87. provider = 'GitBranch',
  88. separator = ' ',
  89. separator_highlight = {colors.purple,colors.bg},
  90. condition = buffer_not_empty,
  91. highlight = {colors.grey,colors.bg},
  92. }
  93. }
  94. local checkwidth = function()
  95. local squeeze_width = vim.fn.winwidth(0) / 2
  96. if squeeze_width > 40 then
  97. return true
  98. end
  99. return false
  100. end
  101. gls.left[5] = {
  102. DiffAdd = {
  103. provider = 'DiffAdd',
  104. condition = checkwidth,
  105. -- separator = ' ',
  106. -- separator_highlight = {colors.purple,colors.bg},
  107. icon = '  ',
  108. highlight = {colors.green,colors.bg},
  109. }
  110. }
  111. gls.left[6] = {
  112. DiffModified = {
  113. provider = 'DiffModified',
  114. condition = checkwidth,
  115. -- separator = ' ',
  116. -- separator_highlight = {colors.purple,colors.bg},
  117. icon = '  ',
  118. highlight = {colors.blue,colors.bg},
  119. }
  120. }
  121. gls.left[7] = {
  122. DiffRemove = {
  123. provider = 'DiffRemove',
  124. condition = checkwidth,
  125. -- separator = ' ',
  126. -- separator_highlight = {colors.purple,colors.bg},
  127. icon = '  ',
  128. highlight = {colors.red,colors.bg},
  129. }
  130. }
  131. gls.left[8] = {
  132. LeftEnd = {
  133. provider = function() return ' ' end,
  134. separator = ' ',
  135. separator_highlight = {colors.purple,colors.bg},
  136. highlight = {colors.purple,colors.bg}
  137. }
  138. }
  139. gls.left[9] = {
  140. DiagnosticError = {
  141. provider = 'DiagnosticError',
  142. icon = '  ',
  143. highlight = {colors.red,colors.bg}
  144. }
  145. }
  146. gls.left[10] = {
  147. Space = {
  148. provider = function () return '' end
  149. }
  150. }
  151. gls.left[11] = {
  152. DiagnosticWarn = {
  153. provider = 'DiagnosticWarn',
  154. icon = '  ',
  155. highlight = {colors.yellow,colors.bg},
  156. }
  157. }
  158. gls.left[12] = {
  159. DiagnosticHint = {
  160. provider = 'DiagnosticHint',
  161. icon = '  ',
  162. highlight = {colors.blue,colors.bg},
  163. }
  164. }
  165. gls.left[13] = {
  166. DiagnosticInfo = {
  167. provider = 'DiagnosticInfo',
  168. icon = '  ',
  169. highlight = {colors.orange,colors.bg},
  170. }
  171. }
  172. gls.right[1]= {
  173. FileFormat = {
  174. provider = 'FileFormat',
  175. separator = ' ',
  176. separator_highlight = {colors.bg,colors.bg},
  177. highlight = {colors.grey,colors.bg},
  178. }
  179. }
  180. gls.right[2] = {
  181. LineInfo = {
  182. provider = 'LineColumn',
  183. separator = ' | ',
  184. separator_highlight = {colors.darkblue,colors.bg},
  185. highlight = {colors.grey,colors.bg},
  186. },
  187. }
  188. gls.right[3] = {
  189. PerCent = {
  190. provider = 'LinePercent',
  191. separator = ' |',
  192. separator_highlight = {colors.darkblue,colors.bg},
  193. highlight = {colors.grey,colors.bg},
  194. }
  195. }
  196. gls.right[4] = {
  197. ScrollBar = {
  198. provider = 'ScrollBar',
  199. highlight = {colors.yellow,colors.purple},
  200. }
  201. }
  202. -- gls.short_line_left[1] = {
  203. -- BufferType = {
  204. -- provider = 'FileTypeName',
  205. -- separator = ' ',
  206. -- separator_highlight = {colors.purple,colors.bg},
  207. -- highlight = {colors.grey,colors.purple}
  208. -- }
  209. -- }
  210. gls.short_line_left[1] = {
  211. LeftEnd = {
  212. provider = function() return ' ' end,
  213. separator = ' ',
  214. separator_highlight = {colors.purple,colors.bg},
  215. highlight = {colors.purple,colors.bg}
  216. }
  217. }