From 10f5844abf30eb9b180efece36639b6eecb33e86 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 Mar 2023 11:17:54 +0100 Subject: [PATCH] fix(loader): never load lua files from a plugin where cond=false. Show error instead --- lua/lazy/core/loader.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 833b432..6ac898c 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -460,6 +460,9 @@ function M.auto_load(modname, modpath) error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false") end M.load(plugin, { require = modname }) + if plugin._.cond == false then + error("You're trying to load `" .. plugin.name .. "` for which `cond==false`") + end end return true end @@ -470,7 +473,6 @@ end function M.loader(modname) local paths = Util.get_unloaded_rtp(modname) local modpath, hash = Cache._Cache.find(modname, { rtp = false, paths = paths }) - -- print(modname .. " " .. paths[1]) if modpath then M.auto_load(modname, modpath) local mod = package.loaded[modname]