mirror of https://github.com/folke/lazy.nvim.git
feat(spec): you can now override specs using only the plugin name instead of the short url
This commit is contained in:
parent
efe72d98e6
commit
0cbd91d2cd
|
@ -64,7 +64,9 @@ function Spec:add(plugin, results, is_dep)
|
||||||
return plugin
|
return plugin
|
||||||
end
|
end
|
||||||
|
|
||||||
if not plugin.url and plugin[1] then
|
local is_ref = plugin[1] and not plugin[1]:find("/", 1, true)
|
||||||
|
|
||||||
|
if not plugin.url and not is_ref and plugin[1] then
|
||||||
local prefix = plugin[1]:sub(1, 4)
|
local prefix = plugin[1]:sub(1, 4)
|
||||||
if prefix == "http" or prefix == "git@" then
|
if prefix == "http" or prefix == "git@" then
|
||||||
plugin.url = plugin[1]
|
plugin.url = plugin[1]
|
||||||
|
@ -95,6 +97,8 @@ function Spec:add(plugin, results, is_dep)
|
||||||
-- remote plugin
|
-- remote plugin
|
||||||
plugin.dir = Config.options.root .. "/" .. plugin.name
|
plugin.dir = Config.options.root .. "/" .. plugin.name
|
||||||
end
|
end
|
||||||
|
elseif is_ref then
|
||||||
|
plugin.name = plugin[1]
|
||||||
else
|
else
|
||||||
self:error("Invalid plugin spec " .. vim.inspect(plugin))
|
self:error("Invalid plugin spec " .. vim.inspect(plugin))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue