mirror of https://github.com/folke/lazy.nvim.git
fix(loader): runtime files are now sourced alphabetically per directory
This commit is contained in:
parent
eeb06a5a50
commit
5c0c381b56
|
@ -166,17 +166,24 @@ end
|
||||||
---@param ... string
|
---@param ... string
|
||||||
function M.source_runtime(...)
|
function M.source_runtime(...)
|
||||||
local dir = table.concat({ ... }, "/")
|
local dir = table.concat({ ... }, "/")
|
||||||
|
---@type string[]
|
||||||
|
local files = {}
|
||||||
Util.walk(dir, function(path, name, t)
|
Util.walk(dir, function(path, name, t)
|
||||||
local ext = name:sub(-3)
|
local ext = name:sub(-3)
|
||||||
name = name:sub(1, -5)
|
name = name:sub(1, -5)
|
||||||
if t == "file" and (ext == "lua" or ext == "vim") and not M.disabled_rtp_plugins[name] then
|
if t == "file" and (ext == "lua" or ext == "vim") and not M.disabled_rtp_plugins[name] then
|
||||||
Util.track({ runtime = path })
|
files[#files + 1] = path
|
||||||
Util.try(function()
|
|
||||||
vim.cmd("silent source " .. path)
|
|
||||||
end, "Failed to source `" .. path .. "`")
|
|
||||||
Util.track()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
-- plugin files are sourced alphabetically per directory
|
||||||
|
table.sort(files)
|
||||||
|
for _, path in ipairs(files) do
|
||||||
|
Util.track({ runtime = path })
|
||||||
|
Util.try(function()
|
||||||
|
vim.cmd("silent source " .. path)
|
||||||
|
end, "Failed to source `" .. path .. "`")
|
||||||
|
Util.track()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- This loader is added as the very last one.
|
-- This loader is added as the very last one.
|
||||||
|
|
Loading…
Reference in New Issue