fix: source plugin files for plugins that want to run a build script during startup

This commit is contained in:
Folke Lemaitre 2022-12-03 17:45:40 +01:00
parent 93d30722a0
commit 3ed24baeb0
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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