Skip to content

Commit

Permalink
feat(spec): you can now override specs using only the plugin name ins…
Browse files Browse the repository at this point in the history
…tead of the short url
  • Loading branch information
folke committed Jan 16, 2023
1 parent efe72d9 commit 0cbd91d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function Spec:add(plugin, results, is_dep)
return plugin
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)
if prefix == "http" or prefix == "git@" then
plugin.url = plugin[1]
Expand Down Expand Up @@ -95,6 +97,8 @@ function Spec:add(plugin, results, is_dep)
-- remote plugin
plugin.dir = Config.options.root .. "/" .. plugin.name
end
elseif is_ref then
plugin.name = plugin[1]
else
self:error("Invalid plugin spec " .. vim.inspect(plugin))
return
Expand Down

0 comments on commit 0cbd91d

Please sign in to comment.