Skip to content

Commit 8564f6d

Browse files
committed
feat(plugin): added support for weak specs. They will not be included in the final spec if not specified somwhere else
1 parent b382495 commit 8564f6d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lua/lazy/core/plugin.lua

+7
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ function Spec:warn(msg)
141141
end
142142

143143
function Spec:fix_disabled()
144+
-- handle weak plugins
145+
for _, plugin in pairs(self.plugins) do
146+
if plugin.weak and not plugin._.super then
147+
self.plugins[plugin.name] = nil
148+
end
149+
end
150+
144151
---@type table<string,string[]> plugin to parent plugin
145152
local dep_of = {}
146153

lua/lazy/types.lua

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
---@field dir string
4848
---@field enabled? boolean|(fun():boolean)
4949
---@field cond? boolean|(fun():boolean)
50+
---@field weak? boolean If set, then this plugin will not be added unless it is added somewhere else
5051
---@field lazy? boolean
5152
---@field priority? number Only useful for lazy=false plugins to force loading certain plugins first. Default priority is 50
5253
---@field dev? boolean If set, then link to the respective folder under your ~/projects

0 commit comments

Comments
 (0)