Skip to content

Commit

Permalink
fix: defer loading lualine updates for inactive statusline. Fixes fol…
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Aug 5, 2021
1 parent cda6218 commit 273c49e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lua/tokyonight/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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

Expand Down
12 changes: 10 additions & 2 deletions lua/tokyonight/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,20 @@ 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
---@param colors ColorScheme
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
Expand All @@ -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
Expand Down

0 comments on commit 273c49e

Please sign in to comment.