46
46
function M .startup ()
47
47
Util .track ({ start = " startup" })
48
48
49
+ -- load filetype.lua first since plugins might depend on that
49
50
M .source (vim .env .VIMRUNTIME .. " /filetype.lua" )
50
51
51
- -- load plugins from rtp, excluding after
52
- Util .track ({ start = " rtp plugins" })
53
- for _ , path in ipairs (vim .opt .rtp :get ()) do
54
- if not path :find (" after/?$" ) then
55
- M .packadd (path )
56
- end
57
- end
58
- Util .track ()
52
+ -- backup original rtp
53
+ local rtp = vim .opt .rtp :get ()
59
54
60
- -- load start plugin
55
+ -- 1. load start plugin
61
56
Util .track ({ start = " start" })
62
57
for _ , plugin in pairs (Config .plugins ) do
63
58
if plugin .lazy == false then
@@ -66,7 +61,16 @@ function M.startup()
66
61
end
67
62
Util .track ()
68
63
69
- -- load after plugins
64
+ -- 2. load plugins from rtp, excluding after
65
+ Util .track ({ start = " rtp plugins" })
66
+ for _ , path in ipairs (rtp ) do
67
+ if not path :find (" after/?$" ) then
68
+ M .packadd (path )
69
+ end
70
+ end
71
+ Util .track ()
72
+
73
+ -- 3. load after plugins
70
74
Util .track ({ start = " after" })
71
75
for _ , path in ipairs (vim .opt .rtp :get ()) do
72
76
if path :find (" after/?$" ) then
@@ -77,7 +81,7 @@ function M.startup()
77
81
78
82
M .init_done = true
79
83
80
- -- run plugin init
84
+ -- 4. run plugin init
81
85
Util .track ({ start = " init" })
82
86
for _ , plugin in pairs (Config .plugins ) do
83
87
if plugin .init then
0 commit comments