diff options
| author | gukz <[email protected]> | 2021-05-27 12:05:23 +0800 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-27 00:05:23 -0400 | 
| commit | 12b5dc796fd6080e9e94b33e5bfa5a15ce8e0fc4 (patch) | |
| tree | 446546e2ad2b378c2989f350d57faf14169c52a0 /lua/lv-galaxyline | |
| parent | 10589dcdf14537d6a52371de9a8236bd84f02979 (diff) | |
Make galaxline component index dynamic (#434)
Diffstat (limited to 'lua/lv-galaxyline')
| -rw-r--r-- | lua/lv-galaxyline/init.lua | 78 | 
1 files changed, 39 insertions, 39 deletions
| diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index b3509c5f..be3b906c 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -25,7 +25,7 @@ local condition = require('galaxyline.condition')  local gls = gl.section  gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} -gls.left[1] = { +table.insert(gls.left, {      ViMode = {          provider = function()              -- auto change color according the vim mode @@ -56,11 +56,11 @@ gls.left[1] = {          end,          highlight = {colors.red, colors.bg}      } -} +})  print(vim.fn.getbufvar(0, 'ts'))  vim.fn.getbufvar(0, 'ts') -gls.left[2] = { +table.insert(gls.left, {      GitIcon = {          provider = function()              return ' ' @@ -70,9 +70,9 @@ gls.left[2] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.orange, colors.bg}      } -} +}) -gls.left[3] = { +table.insert(gls.left, {      GitBranch = {          provider = 'GitBranch',          condition = condition.check_git_workspace, @@ -80,45 +80,45 @@ gls.left[3] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.left[4] = { +table.insert(gls.left, {      DiffAdd = {          provider = 'DiffAdd',          condition = condition.hide_in_width,          icon = '  ',          highlight = {colors.green, colors.bg}      } -} -gls.left[5] = { +}) +table.insert(gls.left, {      DiffModified = {          provider = 'DiffModified',          condition = condition.hide_in_width,          icon = ' 柳',          highlight = {colors.blue, colors.bg}      } -} -gls.left[6] = { +}) +table.insert(gls.left, {      DiffRemove = {          provider = 'DiffRemove',          condition = condition.hide_in_width,          icon = '  ',          highlight = {colors.red, colors.bg}      } -} +}) -gls.right[1] = { +table.insert(gls.right, {      DiagnosticError = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}} -} -gls.right[2] = {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}} +}) +table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}}) -gls.right[3] = { +table.insert(gls.right, {      DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.vivid_blue, colors.bg}} -} +}) -gls.right[4] = {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}} +table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}}) -gls.right[5] = { +table.insert(gls.right, {      TreesitterIcon = {          provider = function()              if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end @@ -128,9 +128,9 @@ gls.right[5] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.green, colors.bg}      } -} +}) -gls.right[6] = { +table.insert(gls.right, {      ShowLspClient = {          provider = 'GetLspClient',          condition = function() @@ -141,27 +141,27 @@ gls.right[6] = {          icon = '  ',          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[7] = { +table.insert(gls.right, {      LineInfo = {          provider = 'LineColumn',          separator = '  ',          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[8] = { +table.insert(gls.right, {      PerCent = {          provider = 'LinePercent',          separator = ' ',          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[9] = { +table.insert(gls.right, {      Tabstop = {          provider = function()              return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " @@ -171,9 +171,9 @@ gls.right[9] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[10] = { +table.insert(gls.right, {      BufferType = {          provider = 'FileTypeName',          condition = condition.hide_in_width, @@ -181,9 +181,9 @@ gls.right[10] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[11] = { +table.insert(gls.right, {      FileEncode = {          provider = 'FileEncode',          condition = condition.hide_in_width, @@ -191,9 +191,9 @@ gls.right[11] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.right[12] = { +table.insert(gls.right, {      Space = {          provider = function()              return ' ' @@ -202,19 +202,19 @@ gls.right[12] = {          separator_highlight = {'NONE', colors.bg},          highlight = {colors.orange, colors.bg}      } -} +}) -gls.short_line_left[1] = { +table.insert(gls.short_line_left, {      BufferType = {          provider = 'FileTypeName',          separator = ' ',          separator_highlight = {'NONE', colors.bg},          highlight = {colors.grey, colors.bg}      } -} +}) -gls.short_line_left[2] = { +table.insert(gls.short_line_left, {      SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}} -} +}) -gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}} +table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}}) | 
