diff --git a/README.md b/README.md index a3a2972..20f0134 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,7 @@ return { path = "~/projects", ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub patterns = {}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist }, install = { -- install missing plugins on startup. This doesn't increase startup time. diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index dd1bdae..e0b50f0 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -31,6 +31,7 @@ M.defaults = { path = "~/projects", ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub patterns = {}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist }, install = { -- install missing plugins on startup. This doesn't increase startup time. diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 4873249..b79cc6b 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -91,7 +91,10 @@ function Spec:add(plugin, results, is_dep) end end -- 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 else -- remote plugin