feat(dev): optionally fallback to git when local plugin doesn't exist (#446)

* feat: fallback to git when local plugin isn't found

* feat(option): fallback to git when local plugin doesn't exist
This commit is contained in:
Null Chilly 2023-01-25 04:55:34 +07:00 committed by GitHub
parent 809d67fcf0
commit 772d8888cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -320,6 +320,7 @@ return {
path = "~/projects", path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"} patterns = {}, -- For example {"folke"}
fallback = false, -- Fallback to git when local plugin doesn't exist
}, },
install = { install = {
-- install missing plugins on startup. This doesn't increase startup time. -- install missing plugins on startup. This doesn't increase startup time.

View File

@ -31,6 +31,7 @@ M.defaults = {
path = "~/projects", path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"} patterns = {}, -- For example {"folke"}
fallback = false, -- Fallback to git when local plugin doesn't exist
}, },
install = { install = {
-- install missing plugins on startup. This doesn't increase startup time. -- install missing plugins on startup. This doesn't increase startup time.

View File

@ -91,7 +91,10 @@ function Spec:add(plugin, results, is_dep)
end end
end end
-- dev plugins -- dev plugins
if plugin.dev then if
plugin.dev
and (not Config.options.dev.fallback or vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1)
then
plugin.dir = Config.options.dev.path .. "/" .. plugin.name plugin.dir = Config.options.dev.path .. "/" .. plugin.name
else else
-- remote plugin -- remote plugin