Fix plugin

This commit is contained in:
Ryan Hughes
2025-09-19 11:28:35 -04:00
parent 00be806b46
commit ff71701174

View File

@@ -5,24 +5,36 @@ return {
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function() config = function()
-- Listen to Lazy's reload event to apply the new colorscheme local function reload_theme()
vim.api.nvim_create_autocmd("User", { -- Clear the module cache
pattern = "LazyReload", package.loaded["plugins.theme"] = nil
callback = function()
package.loaded["plugins.theme"] = nil
local ok, theme_spec = pcall(require, "plugins.theme") local ok, theme_spec = pcall(require, "plugins.theme")
if ok and theme_spec then if ok and theme_spec then
for _, spec in ipairs(theme_spec) do for _, spec in ipairs(theme_spec) do
if spec[1] == "LazyVim/LazyVim" and spec.opts and spec.opts.colorscheme then if spec[1] == "LazyVim/LazyVim" and spec.opts and spec.opts.colorscheme then
vim.schedule(function() local colorscheme = spec.opts.colorscheme
require("lazy.core.loader").colorscheme(spec.opts.colorscheme)
end) vim.schedule(function()
break pcall(vim.cmd, "colorscheme " .. colorscheme)
end vim.notify("Theme reloaded: " .. colorscheme, vim.log.levels.INFO)
-- Reapply transparency if it exists
local transparency_file = vim.fn.stdpath("config") .. "/plugin/after/transparency.lua"
if vim.fn.filereadable(transparency_file) == 1 then
vim.cmd("source " .. transparency_file)
end
end)
break
end end
end end
end, end
end
-- Listen to Lazy's reload event
vim.api.nvim_create_autocmd("User", {
pattern = "LazyReload",
callback = reload_theme,
}) })
end, end,
}, },