Skip to content

Commit

Permalink
fix: source plugin files for plugins that want to run a build script …
Browse files Browse the repository at this point in the history
…during startup
  • Loading branch information
folke committed Dec 3, 2022
1 parent 93d3072 commit 3ed24ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ function M.packadd(plugin)
-- vim.cmd.packadd(plugin.name)
-- M.source_runtime(plugin, "/after/plugin")
if M.init_done then
M.source_runtime(plugin.dir, "/plugin")
M.source_runtime(plugin.dir, "plugin")
if vim.g.did_load_filetypes == 1 then
M.source_runtime(plugin.dir, "/ftdetect")
M.source_runtime(plugin.dir, "ftdetect")
end
M.source_runtime(plugin.dir, "/after/plugin")
M.source_runtime(plugin.dir, "after/plugin")
end
end

Expand Down
7 changes: 4 additions & 3 deletions lua/lazy/manage/task/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ M.build = {
end,
run = function(self)
Loader.load(self.plugin, { task = "build" })
-- when installing during startup, add the package
-- to make sure all runtime files are loaded
Loader.packadd(self.plugin, true)

-- we need to source its plugin files before startup,
-- to make sure the build command has everything available
Loader.source_runtime(self.plugin.dir, "plugin")

local build = self.plugin.build
if build then
Expand Down

0 comments on commit 3ed24ba

Please sign in to comment.