Skip to content

Commit

Permalink
fix(loader): runtime files are now sourced alphabetically per directory
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 17, 2022
1 parent eeb06a5 commit 5c0c381
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5c0c381

Please sign in to comment.