@@ -623,6 +623,7 @@ function Plugin.new(spec)
623623
624624 user_commands = {}, -- Created user commands
625625 run_action = spec .build or nil ,
626+ need_build = false ,
626627 }, Plugin )
627628
628629 return self
@@ -768,7 +769,7 @@ function Plugin:load(do_action, callback)
768769 load_opts (self .config_opts )
769770 end
770771
771- if do_action and self .run_action then
772+ if do_action and self .run_action and self . loaded then
772773 if type (self .run_action ) == ' string' then
773774 vim .cmd (self .run_action )
774775 else
@@ -1138,9 +1139,9 @@ function Plugin:install()
11381139 self :theme (self .colorscheme )
11391140 end
11401141
1141- -- Run build command if specified
1142+ -- need build command if specified
11421143 if self .run_action then
1143- self : load ( true )
1144+ self . need_build = true
11441145 end
11451146 else
11461147 self .status = STATUS .ERROR
@@ -1484,6 +1485,7 @@ function M.install()
14841485 ui :open ()
14851486
14861487 local task_queue = TaskQueue .new (DEFAULT_SETTINGS .max_concurrent_tasks )
1488+ local plugins_with_build = {}
14871489
14881490 -- Create installation tasks with proper error handling
14891491 local install_tasks = {}
@@ -1500,6 +1502,10 @@ function M.install()
15001502 )
15011503 end
15021504
1505+ if plugin .need_build then
1506+ plugins_with_build [# plugins_with_build + 1 ] = plugin
1507+ end
1508+
15031509 done ()
15041510 end )()
15051511 end )
@@ -1513,10 +1519,13 @@ function M.install()
15131519 -- Set completion callback
15141520 task_queue :on_complete (function ()
15151521 M .log (' info' , ' Installation completed.' )
1516-
15171522 -- Close UI after a delay
15181523 Async .await (Async .delay (2000 ))
15191524 ui :close ()
1525+
1526+ for _ , p in ipairs (plugins_with_build ) do
1527+ p :load (true )
1528+ end
15201529 end )
15211530 end )()
15221531end
0 commit comments