Skip to content

Commit

Permalink
feat(plugin): added support for cond for imports (#1079)
Browse files Browse the repository at this point in the history
Co-authored-by: abeldekat <abel@nomail.com>
  • Loading branch information
abeldekat and abeldekat committed Oct 6, 2023
1 parent acda8d2 commit 58e954a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ function Spec:import(spec)
if vim.tbl_contains(self.modules, spec.import) then
return
end
if spec.cond == false or (type(spec.cond) == "function" and not spec.cond()) then
return
end
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
return
end
Expand Down
1 change: 1 addition & 0 deletions lua/lazy/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@
---@class LazySpecImport
---@field import string spec module to import
---@field enabled? boolean|(fun():boolean)
---@field cond? boolean|(fun():boolean)

0 comments on commit 58e954a

Please sign in to comment.