mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 09:48:59 +02:00
feat(util): utility methods for lazy plugins
This commit is contained in:
parent
c14d21ce75
commit
596c439db5
1 changed files with 14 additions and 1 deletions
|
@ -57,9 +57,22 @@ function M.is_win()
|
|||
return vim.uv.os_uname().sysname:find("Windows") ~= nil
|
||||
end
|
||||
|
||||
---@param name string
|
||||
function M.get_plugin(name)
|
||||
return require("lazy.core.config").spec.plugins[name]
|
||||
end
|
||||
|
||||
---@param name string
|
||||
---@param path string?
|
||||
function M.get_plugin_path(name, path)
|
||||
local plugin = M.get_plugin(name)
|
||||
path = path and "/" .. path or ""
|
||||
return plugin and (plugin.dir .. path)
|
||||
end
|
||||
|
||||
---@param plugin string
|
||||
function M.has(plugin)
|
||||
return require("lazy.core.config").spec.plugins[plugin] ~= nil
|
||||
return M.get_plugin(plugin) ~= nil
|
||||
end
|
||||
|
||||
---@param fn fun()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue