Skip to content

fix: break sequencing #874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lua/packer/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ local function verify_conditions(conds, name)
return true
end

local function no_remaining_preloads(plugin)
return plugin.load_after == nil or next(plugin.load_after) == nil
end

local function skip_lazy(plugin, cause)
return (plugin.commands ~= nil or plugin.keys ~= nil) and next(cause) == nil
end

local function loader_clear_loaders(plugin)
if plugin.commands then
for _, del_cmd in ipairs(plugin.commands) do
Expand Down Expand Up @@ -127,7 +135,7 @@ packer_load = function(names, cause, plugins, force)
error(err_message)
end

if not plugin.loaded then
if not plugin.loaded and no_remaining_preloads(plugin) and not skip_lazy(plugin, cause) then
loader_clear_loaders(plugin)
if force or verify_conditions(plugin.cond, names[i]) then
-- Set the plugin as loaded before config is run in case something in the config tries to load
Expand Down