fix(spec): don't import specs more than once

This commit is contained in:
Folke Lemaitre 2023-01-10 09:20:39 +01:00
parent 9fa62ea8ea
commit ad7aafb257
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 4 additions and 0 deletions

View File

@ -225,6 +225,9 @@ function Spec:import(spec)
if spec.import == "lazy" then
return self:error("You can't name your plugins module `lazy`.")
end
if vim.tbl_contains(self.modules, spec.import) then
return
end
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
return
end
@ -278,6 +281,7 @@ function Spec:merge(old, new)
end
new._.super = old
setmetatable(new, { __index = old })
return new
end