mirror of https://github.com/folke/lazy.nvim.git
fix(loader): always load init.lua in plugin mods
This commit is contained in:
parent
9e90852a47
commit
60e96b478a
|
@ -271,7 +271,7 @@ function M.find_dir(modname)
|
||||||
local modpath = M.find(modname, { patterns = { "" } })
|
local modpath = M.find(modname, { patterns = { "" } })
|
||||||
if modpath then
|
if modpath then
|
||||||
local root = modpath:gsub("/init%.lua$", ""):gsub("%.lua$", "")
|
local root = modpath:gsub("/init%.lua$", ""):gsub("%.lua$", "")
|
||||||
return root, (root ~= modpath and modpath or nil)
|
return root, modpath
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -200,12 +200,14 @@ function M.lsmod(modname, fn)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if modpath and vim.loop.fs_stat(modpath) then
|
if modpath and not modpath:find("/init%.lua$") and vim.loop.fs_stat(modpath) then
|
||||||
fn(modname, modpath)
|
fn(modname, modpath)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.ls(root, function(path, name, type)
|
M.ls(root, function(path, name, type)
|
||||||
if name ~= "init.lua" and (type == "file" or type == "link") and name:sub(-4) == ".lua" then
|
if name == "init.lua" then
|
||||||
|
fn(modname, path)
|
||||||
|
elseif (type == "file" or type == "link") and name:sub(-4) == ".lua" then
|
||||||
fn(modname .. "." .. name:sub(1, -5), path)
|
fn(modname .. "." .. name:sub(1, -5), path)
|
||||||
elseif type == "directory" and vim.loop.fs_stat(path .. "/init.lua") then
|
elseif type == "directory" and vim.loop.fs_stat(path .. "/init.lua") then
|
||||||
fn(modname .. "." .. name, path .. "/init.lua")
|
fn(modname .. "." .. name, path .. "/init.lua")
|
||||||
|
|
Loading…
Reference in New Issue