fix: only call theme's setup if it's selected (#3586)

This commit is contained in:
LostNeophyte 2022-12-12 15:06:02 +01:00 committed by GitHub
parent d3ade21d85
commit f02b0585a8
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,13 +64,16 @@ M.setup = function()
end
local selected_theme = lvim.builtin.theme.name
local status_ok, plugin = pcall(require, selected_theme)
if not status_ok then
return
if vim.startswith(lvim.colorscheme, selected_theme) then
local status_ok, plugin = pcall(require, selected_theme)
if not status_ok then
return
end
pcall(function()
plugin.setup(lvim.builtin.theme[selected_theme].options)
end)
end
pcall(function()
plugin.setup(lvim.builtin.theme[selected_theme].options)
end)
-- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564
local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false)