chore(utils): cleanup utils to support other than lazy.nvim (#256)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-08-27 01:46:23 -04:00
committed by GitHub
parent 3369f732c5
commit 64cedd61d5
2 changed files with 8 additions and 18 deletions

View File

@@ -20,7 +20,11 @@ setmetatable(M, {
---@param plugin string
---@return boolean
M.has = function(plugin)
return require("lazy.core.config").plugins[plugin] ~= nil
local ok, LazyConfig = pcall(require, "lazy.core.config")
if ok then
return LazyConfig.plugins[plugin] ~= nil
end
return package.loaded[plugin] ~= nil
end
---@alias _ToggleSet fun(state: boolean): nil