@@ -16,6 +16,7 @@ M.init_done = false
16
16
M .disabled_rtp_plugins = { packer_compiled = true }
17
17
--- @type table<string,string>
18
18
M .did_ftdetect = {}
19
+ M .did_handlers = false
19
20
20
21
function M .disable_rtp_plugin (plugin )
21
22
M .disabled_rtp_plugins [plugin ] = true
@@ -56,6 +57,7 @@ function M.setup()
56
57
-- setup handlers
57
58
Util .track (" handlers" )
58
59
Handler .setup ()
60
+ M .did_handlers = true
59
61
Util .track ()
60
62
end
61
63
@@ -498,8 +500,11 @@ function M.auto_load(modname, modpath)
498
500
local plugin = Plugin .find (modpath )
499
501
if plugin and modpath :find (plugin .dir , 1 , true ) == 1 then
500
502
plugin ._ .rtp_loaded = true
501
- -- don't load if we're loading specs or if the plugin is already loaded
502
- if not (Plugin .loading or plugin ._ .loaded ) then
503
+ -- don't load if:
504
+ -- * handlers haven't been setup yet
505
+ -- * we're loading specs
506
+ -- * the plugin is already loaded
507
+ if M .did_handlers and not (Plugin .loading or plugin ._ .loaded ) then
503
508
if plugin .module == false then
504
509
error (" Plugin " .. plugin .name .. " is not loaded and is configured with module=false" )
505
510
end
@@ -508,9 +513,7 @@ function M.auto_load(modname, modpath)
508
513
error (" You're trying to load `" .. plugin .name .. " ` for which `cond==false`" )
509
514
end
510
515
end
511
- return true
512
516
end
513
- return false
514
517
end
515
518
516
519
--- @param modname string
0 commit comments