diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index c510d69..60ea915 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -166,17 +166,24 @@ end ---@param ... string function M.source_runtime(...) local dir = table.concat({ ... }, "/") + ---@type string[] + local files = {} Util.walk(dir, function(path, name, t) local ext = name:sub(-3) name = name:sub(1, -5) if t == "file" and (ext == "lua" or ext == "vim") and not M.disabled_rtp_plugins[name] then - Util.track({ runtime = path }) - Util.try(function() - vim.cmd("silent source " .. path) - end, "Failed to source `" .. path .. "`") - Util.track() + files[#files + 1] = path 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 -- This loader is added as the very last one.