mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 11:24:14 +00:00
also added dev.paths option
This commit is contained in:
parent
d5e48c8ea1
commit
d902783d7a
2 changed files with 23 additions and 2 deletions
|
@ -32,6 +32,7 @@ M.defaults = {
|
||||||
dev = {
|
dev = {
|
||||||
-- directory where you store your local plugin projects
|
-- directory where you store your local plugin projects
|
||||||
path = "~/projects",
|
path = "~/projects",
|
||||||
|
extra_paths = nil,
|
||||||
---@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
|
fallback = false, -- Fallback to git when local plugin doesn't exist
|
||||||
|
|
|
@ -106,11 +106,31 @@ function Spec:add(plugin, results)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dev plugins
|
-- dev plugins
|
||||||
|
local devPath = nil
|
||||||
|
|
||||||
|
-- check dev.path, and if not check dev.extra_paths
|
||||||
|
-- if not found, devPath will remain nil
|
||||||
|
if plugin.dev then
|
||||||
|
if vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1 then
|
||||||
|
devPath = Config.options.dev.path .. "/" .. plugin.name
|
||||||
|
elseif Config.options.dev.extra_paths
|
||||||
|
and type(Config.options.dev.extra_paths) == 'table'
|
||||||
|
then
|
||||||
|
for _, path in ipairs(Config.options.dev.extra_paths) do
|
||||||
|
if vim.fn.isdirectory(path .. "/" .. plugin.name) == 1 then
|
||||||
|
path = devPath
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if dev, add dev path as plugin dir, otherwise use root
|
||||||
if
|
if
|
||||||
plugin.dev
|
plugin.dev
|
||||||
and (not Config.options.dev.fallback or vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1)
|
and (not Config.options.dev.fallback or devPath)
|
||||||
then
|
then
|
||||||
dir = Config.options.dev.path .. "/" .. plugin.name
|
dir = devPath
|
||||||
elseif plugin.dev == false then
|
elseif plugin.dev == false then
|
||||||
-- explicitely select the default path
|
-- explicitely select the default path
|
||||||
dir = Config.options.root .. "/" .. plugin.name
|
dir = Config.options.root .. "/" .. plugin.name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue