feat(plugin)!: cond is now the same as enabled, but skips clean

This commit is contained in:
Folke Lemaitre 2023-07-06 15:30:01 +02:00
parent f8611632d0
commit fbb0bea2db
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 31 additions and 13 deletions

View file

@ -297,15 +297,8 @@ function M._load(plugin, reason, opts)
return Util.error("Plugin " .. plugin.name .. " is not installed")
end
local cond = plugin.cond
if cond == nil then
cond = Config.options.defaults.cond
end
if cond ~= nil and not (opts and opts.force) then
if cond == false or (type(cond) == "function" and not cond(plugin)) then
plugin._.cond = false
return
end
if plugin._.cond == false and not (opts and opts.force) then
return
end
---@diagnostic disable-next-line: assign-type-mismatch