Skip to content

Commit 58e954a

Browse files
abeldekatabeldekat
and
abeldekat
authored
feat(plugin): added support for cond for imports (#1079)
Co-authored-by: abeldekat <[email protected]>
1 parent acda8d2 commit 58e954a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lua/lazy/core/plugin.lua

+3
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ function Spec:import(spec)
380380
if vim.tbl_contains(self.modules, spec.import) then
381381
return
382382
end
383+
if spec.cond == false or (type(spec.cond) == "function" and not spec.cond()) then
384+
return
385+
end
383386
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
384387
return
385388
end

lua/lazy/types.lua

+1
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@
7575
---@class LazySpecImport
7676
---@field import string spec module to import
7777
---@field enabled? boolean|(fun():boolean)
78+
---@field cond? boolean|(fun():boolean)

0 commit comments

Comments
 (0)