mirror of https://github.com/folke/lazy.nvim.git
feat(plugin): added support for `cond` for imports (#1079)
Co-authored-by: abeldekat <abel@nomail.com>
This commit is contained in:
parent
acda8d29ca
commit
58e954a735
|
@ -380,6 +380,9 @@ function Spec:import(spec)
|
||||||
if vim.tbl_contains(self.modules, spec.import) then
|
if vim.tbl_contains(self.modules, spec.import) then
|
||||||
return
|
return
|
||||||
end
|
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
|
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,3 +75,4 @@
|
||||||
---@class LazySpecImport
|
---@class LazySpecImport
|
||||||
---@field import string spec module to import
|
---@field import string spec module to import
|
||||||
---@field enabled? boolean|(fun():boolean)
|
---@field enabled? boolean|(fun():boolean)
|
||||||
|
---@field cond? boolean|(fun():boolean)
|
||||||
|
|
Loading…
Reference in New Issue