mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-23 03:47:33 +00:00
Force theme switch
This commit is contained in:
parent
4fb61693a8
commit
38a0919865
@ -1,10 +1,14 @@
|
|||||||
-- Update colors based on environment variables
|
-- Update colors based on environment variables
|
||||||
function _G.update_colors()
|
function _G.update_colors()
|
||||||
local function maybe_set(scope, name, val)
|
local function maybe_set(scope, name, val, force)
|
||||||
|
force = force or false
|
||||||
if vim[scope][name] ~= val then
|
if vim[scope][name] ~= val then
|
||||||
vim[scope][name] = val
|
vim[scope][name] = val
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
if force then
|
||||||
|
vim[scope][name] = val
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,12 +31,12 @@ function _G.update_colors()
|
|||||||
env_color = utils.env_default("VIM_COLOR_DARK", env_color)
|
env_color = utils.env_default("VIM_COLOR_DARK", env_color)
|
||||||
env_color = utils.env_default("NVIM_COLOR_DARK", env_color)
|
env_color = utils.env_default("NVIM_COLOR_DARK", env_color)
|
||||||
change = maybe_set("o", "background", "dark")
|
change = maybe_set("o", "background", "dark")
|
||||||
change = maybe_set("g", "colors_name", env_color) or change
|
change = maybe_set("g", "colors_name", env_color, true) or change
|
||||||
elseif mode == "light" then
|
elseif mode == "light" then
|
||||||
env_color = utils.env_default("VIM_COLOR_LIGHT", env_color)
|
env_color = utils.env_default("VIM_COLOR_LIGHT", env_color)
|
||||||
env_color = utils.env_default("NVIM_COLOR_LIGHT", env_color)
|
env_color = utils.env_default("NVIM_COLOR_LIGHT", env_color)
|
||||||
change = maybe_set("o", "background", "light")
|
change = maybe_set("o", "background", "light")
|
||||||
change = maybe_set("g", "colors_name", env_color) or change
|
change = maybe_set("g", "colors_name", env_color, true) or change
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update status line theme
|
-- Update status line theme
|
||||||
|
Loading…
Reference in New Issue
Block a user