Skip to content

Commit 3ed24ba

Browse files
committed
fix: source plugin files for plugins that want to run a build script during startup
1 parent 93d3072 commit 3ed24ba

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lua/lazy/core/loader.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ function M.packadd(plugin)
121121
-- vim.cmd.packadd(plugin.name)
122122
-- M.source_runtime(plugin, "/after/plugin")
123123
if M.init_done then
124-
M.source_runtime(plugin.dir, "/plugin")
124+
M.source_runtime(plugin.dir, "plugin")
125125
if vim.g.did_load_filetypes == 1 then
126-
M.source_runtime(plugin.dir, "/ftdetect")
126+
M.source_runtime(plugin.dir, "ftdetect")
127127
end
128-
M.source_runtime(plugin.dir, "/after/plugin")
128+
M.source_runtime(plugin.dir, "after/plugin")
129129
end
130130
end
131131

lua/lazy/manage/task/plugin.lua

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ M.build = {
1010
end,
1111
run = function(self)
1212
Loader.load(self.plugin, { task = "build" })
13-
-- when installing during startup, add the package
14-
-- to make sure all runtime files are loaded
15-
Loader.packadd(self.plugin, true)
13+
14+
-- we need to source its plugin files before startup,
15+
-- to make sure the build command has everything available
16+
Loader.source_runtime(self.plugin.dir, "plugin")
1617

1718
local build = self.plugin.build
1819
if build then

0 commit comments

Comments
 (0)