nvcodeline.lua 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. condition = buffer_not_empty,
  112. highlight = {colors.grey,colors.bg},
  113. }
  114. }
  115. local checkwidth = function()
  116. local squeeze_width = vim.fn.winwidth(0) / 2
  117. if squeeze_width > 40 then
  118. return true
  119. end
  120. return false
  121. end
  122. gls.left[5] = {
  123. DiffAdd = {
  124. provider = 'DiffAdd',
  125. condition = checkwidth,
  126. icon = '  ',
  127. highlight = {colors.green,colors.bg},
  128. }
  129. }
  130. gls.left[6] = {
  131. DiffModified = {
  132. provider = 'DiffModified',
  133. condition = checkwidth,
  134. icon = '  ',
  135. highlight = {colors.blue,colors.bg},
  136. }
  137. }
  138. gls.left[7] = {
  139. DiffRemove = {
  140. provider = 'DiffRemove',
  141. condition = checkwidth,
  142. icon = '  ',
  143. highlight = {colors.red,colors.bg},
  144. }
  145. }
  146. gls.left[8] = {
  147. LeftEnd = {
  148. provider = function() return ' ' end,
  149. separator = ' ',
  150. separator_highlight = {colors.purple,colors.bg},
  151. highlight = {colors.purple,colors.bg}
  152. }
  153. }
  154. gls.left[9] = {
  155. DiagnosticError = {
  156. provider = 'DiagnosticError',
  157. icon = '  ',
  158. highlight = {colors.red,colors.bg}
  159. }
  160. }
  161. gls.left[10] = {
  162. Space = {
  163. provider = function () return '' end
  164. }
  165. }
  166. gls.left[11] = {
  167. DiagnosticWarn = {
  168. provider = 'DiagnosticWarn',
  169. icon = '  ',
  170. highlight = {colors.yellow,colors.bg},
  171. }
  172. }
  173. gls.left[12] = {
  174. DiagnosticHint = {
  175. provider = 'DiagnosticHint',
  176. icon = '  ',
  177. highlight = {colors.blue,colors.bg},
  178. }
  179. }
  180. gls.right[1]= {
  181. FileFormat = {
  182. provider = 'FileFormat',
  183. separator = ' ',
  184. separator_highlight = {colors.bg,colors.bg},
  185. highlight = {colors.grey,colors.bg},
  186. }
  187. }
  188. gls.right[2] = {
  189. LineInfo = {
  190. provider = 'LineColumn',
  191. separator = ' | ',
  192. separator_highlight = {colors.darkblue,colors.bg},
  193. highlight = {colors.grey,colors.bg},
  194. },
  195. }
  196. gls.right[3] = {
  197. PerCent = {
  198. provider = 'LinePercent',
  199. separator = ' |',
  200. separator_highlight = {colors.darkblue,colors.bg},
  201. highlight = {colors.grey,colors.bg},
  202. }
  203. }
  204. gls.right[4] = {
  205. ScrollBar = {
  206. provider = 'ScrollBar',
  207. highlight = {colors.yellow,colors.purple},
  208. }
  209. }
  210. -- gls.short_line_left[1] = {
  211. -- BufferType = {
  212. -- provider = 'FileTypeName',
  213. -- separator = ' ',
  214. -- separator_highlight = {colors.purple,colors.bg},
  215. -- highlight = {colors.grey,colors.purple}
  216. -- }
  217. -- }
  218. gls.short_line_left[1] = {
  219. LeftEnd = {
  220. provider = function() return ' ' end,
  221. separator = ' ',
  222. separator_highlight = {colors.purple,colors.bg},
  223. highlight = {colors.purple,colors.bg}
  224. }
  225. }
  226. -- gls.short_line_right[1] = {
  227. -- BufferIcon = {
  228. -- provider= 'BufferIcon',
  229. -- separator = ' ',
  230. -- separator_highlight = {colors.purple,colors.bg},
  231. -- highlight = {colors.grey,colors.purple}
  232. -- }
  233. -- }