fix: defer loading lualine updates for inactive statusline. Fixes #78

This commit is contained in:
Folke Lemaitre
2021-08-05 13:51:06 +02:00
parent 1ea69504b6
commit a5b3cbe750
2 changed files with 13 additions and 3 deletions

View File

@@ -405,6 +405,8 @@ function M.setup(config)
LightspeedGreyWash = { fg = c.dark3 },
}
theme.defer = {}
if config.hideInactiveStatusline then
local inactive = { style = "underline", bg = c.bg, fg = c.bg, sp = c.border }
@@ -413,7 +415,7 @@ function M.setup(config)
-- LuaLine
for _, section in ipairs({ "a", "b", "c" }) do
theme.plugins["lualine_" .. section .. "_inactive"] = inactive
theme.defer["lualine_" .. section .. "_inactive"] = inactive
end
end

View File

@@ -238,6 +238,10 @@ function util.load(theme)
util.syntax(theme.plugins)
util.terminal(theme.colors)
util.autocmds(theme.config)
vim.defer_fn(function()
util.syntax(theme.defer)
end, 100)
end
---@param config Config
@@ -245,7 +249,9 @@ end
function util.color_overrides(colors, config)
if type(config.colors) == "table" then
for key, value in pairs(config.colors) do
if not colors[key] then error("Color " .. key .. " does not exist") end
if not colors[key] then
error("Color " .. key .. " does not exist")
end
-- Patch: https://github.com/ful1e5/onedark.nvim/issues/6
if type(colors[key]) == "table" then
@@ -259,7 +265,9 @@ function util.color_overrides(colors, config)
colors[key] = value
else
-- another group
if not colors[value] then error("Color " .. value .. " does not exist") end
if not colors[value] then
error("Color " .. value .. " does not exist")
end
colors[key] = colors[value]
end
end