From ad7aafb257516cefff85aceb5d36041090b40559 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Jan 2023 09:20:39 +0100 Subject: [PATCH] fix(spec): don't import specs more than once --- lua/lazy/core/plugin.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 135bdd6..bdba503 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -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