@@ -58,16 +58,27 @@ function M.startup()
58
58
-- backup original rtp
59
59
local rtp = vim .opt .rtp :get ()
60
60
61
- -- 1. load start plugin
61
+ -- 1. run plugin init
62
+ Util .track ({ start = " init" })
63
+ for _ , plugin in pairs (Config .plugins ) do
64
+ if plugin .init then
65
+ Util .track ({ plugin = plugin .name , init = " init" })
66
+ Util .try (plugin .init , " Failed to run `init` for **" .. plugin .name .. " **" )
67
+ Util .track ()
68
+ end
69
+ end
70
+ Util .track ()
71
+
72
+ -- 2. load start plugin
62
73
Util .track ({ start = " start" })
63
74
for _ , plugin in pairs (Config .plugins ) do
64
- if plugin .lazy == false then
75
+ if plugin .lazy == false and not plugin . _ . loaded then
65
76
M .load (plugin , { start = " start" })
66
77
end
67
78
end
68
79
Util .track ()
69
80
70
- -- 2 . load plugins from rtp, excluding after
81
+ -- 3 . load plugins from rtp, excluding after
71
82
Util .track ({ start = " rtp plugins" })
72
83
for _ , path in ipairs (rtp ) do
73
84
if not path :find (" after/?$" ) then
@@ -76,7 +87,7 @@ function M.startup()
76
87
end
77
88
Util .track ()
78
89
79
- -- 3 . load after plugins
90
+ -- 4 . load after plugins
80
91
Util .track ({ start = " after" })
81
92
for _ , path in ipairs (vim .opt .rtp :get ()) do
82
93
if path :find (" after/?$" ) then
@@ -87,17 +98,6 @@ function M.startup()
87
98
88
99
M .init_done = true
89
100
90
- -- 4. run plugin init
91
- Util .track ({ start = " init" })
92
- for _ , plugin in pairs (Config .plugins ) do
93
- if plugin .init then
94
- Util .track ({ plugin = plugin .name , init = " init" })
95
- Util .try (plugin .init , " Failed to run `init` for **" .. plugin .name .. " **" )
96
- Util .track ()
97
- end
98
- end
99
- Util .track ()
100
-
101
101
Util .track ()
102
102
end
103
103
0 commit comments