Skip to content

Commit 772d888

Browse files
authored
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
1 parent 809d67f commit 772d888

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

README.md

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

lua/lazy/core/config.lua

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

lua/lazy/core/plugin.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ function Spec:add(plugin, results, is_dep)
9191
end
9292
end
9393
-- dev plugins
94-
if plugin.dev then
94+
if
95+
plugin.dev
96+
and (not Config.options.dev.fallback or vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1)
97+
then
9598
plugin.dir = Config.options.dev.path .. "/" .. plugin.name
9699
else
97100
-- remote plugin

0 commit comments

Comments
 (0)