galaxyline-config.lua 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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[1] = {
  25. -- FirstElement = {
  26. -- -- provider = function() return '▋' end,
  27. -- provider = function() return ' ' end,
  28. -- highlight = {colors.bg,colors.bg}
  29. -- },
  30. -- }
  31. -- gls.left[2] = {
  32. -- ViMode = {
  33. -- provider = function()
  34. -- local alias = {n = 'NORMAL',i = 'INSERT',c= 'COMMAND',V= 'VISUAL', [''] = 'VISUAL'}
  35. -- return alias[vim.fn.mode()]
  36. -- end,
  37. -- separator = ' ',
  38. -- separator_highlight = {colors.yellow,function()
  39. -- if not buffer_not_empty() then
  40. -- return colors.purple
  41. -- end
  42. -- return colors.purple
  43. -- end},
  44. -- highlight = {colors.grey,colors.purple,'bold'},
  45. -- },
  46. -- }
  47. gls.left[2] = {
  48. ViMode = {
  49. provider = function()
  50. -- auto change color according the vim mode
  51. local mode_color = {n = colors.purple,
  52. i = colors.green,
  53. v = colors.blue,
  54. [''] = colors.blue,
  55. V = colors.blue,
  56. c = colors.purple,
  57. no = colors.magenta,
  58. s = colors.orange,
  59. S = colors.orange,
  60. [''] = colors.orange,
  61. ic = colors.yellow,
  62. R = colors.red,
  63. Rv = colors.red,
  64. cv = colors.red,
  65. ce=colors.red,
  66. r = colors.cyan,
  67. rm = colors.cyan,
  68. ['r?'] = colors.cyan,
  69. ['!'] = colors.red,
  70. t = colors.red}
  71. vim.api.nvim_command('hi GalaxyViMode guibg='..mode_color[vim.fn.mode()])
  72. return ' NVCode '
  73. end,
  74. separator = ' ',
  75. separator_highlight = {colors.yellow,function()
  76. if not buffer_not_empty() then
  77. return colors.bg
  78. end
  79. return colors.bg
  80. end},
  81. highlight = {colors.grey,colors.bg,'bold'},
  82. },
  83. }
  84. -- gls.left[3] ={
  85. -- FileIcon = {
  86. -- separator = ' ',
  87. -- provider = 'FileIcon',
  88. -- condition = buffer_not_empty,
  89. -- highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg},
  90. -- },
  91. -- }
  92. -- gls.left[4] = {
  93. -- FileName = {
  94. -- provider = {'FileSize'},
  95. -- condition = buffer_not_empty,
  96. -- separator = ' ',
  97. -- separator_highlight = {colors.purple,colors.bg},
  98. -- highlight = {colors.magenta,colors.bg}
  99. -- }
  100. -- }
  101. gls.left[3] = {
  102. GitIcon = {
  103. provider = function() return ' ' end,
  104. condition = buffer_not_empty,
  105. highlight = {colors.orange,colors.bg},
  106. }
  107. }
  108. gls.left[4] = {
  109. GitBranch = {
  110. provider = 'GitBranch',
  111. separator = ' ',
  112. separator_highlight = {colors.purple,colors.bg},
  113. condition = buffer_not_empty,
  114. highlight = {colors.grey,colors.bg},
  115. }
  116. }
  117. local checkwidth = function()
  118. local squeeze_width = vim.fn.winwidth(0) / 2
  119. if squeeze_width > 40 then
  120. return true
  121. end
  122. return false
  123. end
  124. gls.left[5] = {
  125. DiffAdd = {
  126. provider = 'DiffAdd',
  127. condition = checkwidth,
  128. -- separator = ' ',
  129. -- separator_highlight = {colors.purple,colors.bg},
  130. icon = '  ',
  131. highlight = {colors.green,colors.bg},
  132. }
  133. }
  134. gls.left[6] = {
  135. DiffModified = {
  136. provider = 'DiffModified',
  137. condition = checkwidth,
  138. -- separator = ' ',
  139. -- separator_highlight = {colors.purple,colors.bg},
  140. icon = '  ',
  141. highlight = {colors.blue,colors.bg},
  142. }
  143. }
  144. gls.left[7] = {
  145. DiffRemove = {
  146. provider = 'DiffRemove',
  147. condition = checkwidth,
  148. -- separator = ' ',
  149. -- separator_highlight = {colors.purple,colors.bg},
  150. icon = '  ',
  151. highlight = {colors.red,colors.bg},
  152. }
  153. }
  154. gls.left[8] = {
  155. LeftEnd = {
  156. provider = function() return ' ' end,
  157. separator = ' ',
  158. separator_highlight = {colors.purple,colors.bg},
  159. highlight = {colors.purple,colors.bg}
  160. }
  161. }
  162. gls.left[9] = {
  163. DiagnosticError = {
  164. provider = 'DiagnosticError',
  165. icon = '  ',
  166. highlight = {colors.red,colors.bg}
  167. }
  168. }
  169. gls.left[10] = {
  170. Space = {
  171. provider = function () return '' end
  172. }
  173. }
  174. gls.left[11] = {
  175. DiagnosticWarn = {
  176. provider = 'DiagnosticWarn',
  177. icon = '  ',
  178. highlight = {colors.yellow,colors.bg},
  179. }
  180. }
  181. gls.left[12] = {
  182. DiagnosticHint = {
  183. provider = 'DiagnosticHint',
  184. icon = '  ',
  185. highlight = {colors.blue,colors.bg},
  186. }
  187. }
  188. gls.left[13] = {
  189. DiagnosticInfo = {
  190. provider = 'DiagnosticInfo',
  191. icon = '  ',
  192. highlight = {colors.orange,colors.bg},
  193. }
  194. }
  195. gls.right[1]= {
  196. FileFormat = {
  197. provider = 'FileFormat',
  198. separator = ' ',
  199. separator_highlight = {colors.bg,colors.bg},
  200. highlight = {colors.grey,colors.bg},
  201. }
  202. }
  203. gls.right[2] = {
  204. LineInfo = {
  205. provider = 'LineColumn',
  206. separator = ' | ',
  207. separator_highlight = {colors.darkblue,colors.bg},
  208. highlight = {colors.grey,colors.bg},
  209. },
  210. }
  211. gls.right[3] = {
  212. PerCent = {
  213. provider = 'LinePercent',
  214. separator = ' |',
  215. separator_highlight = {colors.darkblue,colors.bg},
  216. highlight = {colors.grey,colors.bg},
  217. }
  218. }
  219. gls.right[4] = {
  220. ScrollBar = {
  221. provider = 'ScrollBar',
  222. highlight = {colors.yellow,colors.purple},
  223. }
  224. }
  225. -- gls.short_line_left[1] = {
  226. -- BufferType = {
  227. -- provider = 'FileTypeName',
  228. -- separator = ' ',
  229. -- separator_highlight = {colors.purple,colors.bg},
  230. -- highlight = {colors.grey,colors.purple}
  231. -- }
  232. -- }
  233. gls.short_line_left[1] = {
  234. LeftEnd = {
  235. provider = function() return ' ' end,
  236. separator = ' ',
  237. separator_highlight = {colors.purple,colors.bg},
  238. highlight = {colors.purple,colors.bg}
  239. }
  240. }
  241. -- gls.short_line_right[1] = {
  242. -- BufferIcon = {
  243. -- provider= 'BufferIcon',
  244. -- separator = ' ',
  245. -- separator_highlight = {colors.purple,colors.bg},
  246. -- highlight = {colors.grey,colors.purple}
  247. -- }
  248. -- }
  249. -- function! s:my_bookmark_color() abort
  250. -- let s:scl_guibg = matchstr(execute('hi SignColumn'), 'guibg=\zs\S*')
  251. -- if empty(s:scl_guibg)
  252. -- let s:scl_guibg = 'NONE'
  253. -- endif
  254. -- exe 'hi MyBookmarkSign guifg=' . s:scl_guibg
  255. -- endfunction
  256. -- call s:my_bookmark_color() " don't remove this line!
  257. -- augroup UserGitSignColumnColor
  258. -- autocmd!
  259. -- autocmd ColorScheme * call s:my_bookmark_color()
  260. -- augroup END