modularize statusline config | Make overriding of it actually work (#1307)
This commit is contained in:
parent
d0cd5714a2
commit
cd5d85a11b
3 changed files with 20 additions and 20 deletions
|
@ -23,7 +23,7 @@ M.ui = {
|
|||
|
||||
statusline = {
|
||||
separator_style = "default", -- default/round/block/arrow
|
||||
config = "%!v:lua.require('ui.statusline').run()",
|
||||
config = "%!v:lua.require('ui.statusline')",
|
||||
override = {},
|
||||
},
|
||||
|
||||
|
|
19
lua/ui/statusline/init.lua
Normal file
19
lua/ui/statusline/init.lua
Normal 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(),
|
||||
}
|
|
@ -135,23 +135,4 @@ M.cursor_position = function()
|
|||
return left_sep .. "%#St_pos_text#" .. " " .. text .. " "
|
||||
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
|
Loading…
Reference in a new issue