modularize statusline config | Make overriding of it actually work (#1307)

This commit is contained in:
siduck 2022-07-04 07:09:38 +05:30
parent d0cd5714a2
commit cd5d85a11b
3 changed files with 20 additions and 20 deletions

View file

@ -23,7 +23,7 @@ M.ui = {
statusline = { statusline = {
separator_style = "default", -- default/round/block/arrow separator_style = "default", -- default/round/block/arrow
config = "%!v:lua.require('ui.statusline').run()", config = "%!v:lua.require('ui.statusline')",
override = {}, override = {},
}, },

View file

@ -0,0 +1,19 @@
local modules = require "ui.statusline.modules"
local user_override = require("core.utils").load_config().ui.statusline.override
modules = vim.tbl_deep_extend("force", modules, user_override)
return table.concat {
modules.mode(),
modules.fileInfo(),
modules.git(),
"%=",
modules.LSP_progress(),
"%=",
modules.LSP_Diagnostics(),
modules.LSP_status() or "",
modules.cwd(),
modules.cursor_position(),
}

View file

@ -135,23 +135,4 @@ M.cursor_position = function()
return left_sep .. "%#St_pos_text#" .. " " .. text .. " " return left_sep .. "%#St_pos_text#" .. " " .. text .. " "
end end
M.run = function()
return table.concat {
M.mode(),
M.fileInfo(),
M.git(),
"%=",
M.LSP_progress(),
"%=",
M.LSP_Diagnostics(),
M.LSP_status() or "",
M.cwd(),
M.cursor_position(),
}
end
M = vim.tbl_deep_extend("force", M, require("core.utils").load_config().ui.statusline.override)
return M return M