From 5bdb12a038e5a72cc793f38893f1a9c9fb741759 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 19 Jul 2024 08:57:35 +0200 Subject: [PATCH] fix(build): only load the plugin before build for `:` build commands --- lua/lazy/manage/task/plugin.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/lazy/manage/task/plugin.lua b/lua/lazy/manage/task/plugin.lua index fd6c12b..bd565f8 100644 --- a/lua/lazy/manage/task/plugin.lua +++ b/lua/lazy/manage/task/plugin.lua @@ -19,6 +19,9 @@ local B = {} ---@param task LazyTask ---@param build string function B.cmd(task, build) + if task.plugin.build ~= "rockspec" then + Loader.load(task.plugin, { task = "build" }) + end local cmd = vim.api.nvim_parse_cmd(build:sub(2), {}) --[[@as vim.api.keyset.cmd]] task:log(vim.api.nvim_cmd(cmd, { output = true })) end @@ -48,10 +51,6 @@ M.build = { run = function(self) vim.cmd([[silent! runtime plugin/rplugin.vim]]) - if self.plugin.build ~= "rockspec" then - Loader.load(self.plugin, { task = "build" }) - end - local builders = self.plugin.build -- Skip if `build` is set to `false`