feat: when a plugin is disabled conditionally, do not import its additional plugin modules.

This commit is contained in:
abeldekat 2023-10-06 12:40:13 +02:00
commit beeafc6456
2 changed files with 4 additions and 0 deletions

View file

@ -380,6 +380,9 @@ function Spec:import(spec)
if vim.tbl_contains(self.modules, spec.import) then
return
end
if spec.cond == false or (type(spec.cond) == "function" and not spec.cond()) then
return
end
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
return
end

View file

@ -75,3 +75,4 @@
---@class LazySpecImport
---@field import string spec module to import
---@field enabled? boolean|(fun():boolean)
---@field cond? boolean|(fun():boolean)