diff --git a/lua/rocks-lazy/internal.lua b/lua/rocks-lazy/internal.lua index 4cc86c0..51fe5d9 100644 --- a/lua/rocks-lazy/internal.lua +++ b/lua/rocks-lazy/internal.lua @@ -9,9 +9,13 @@ function rocks_lazy.load() local user_rocks = api.get_user_rocks() local has_rocks_config, rocks_config = pcall(require, "rocks-config") - ---@type fun(name: string) | nil - local config_hook = has_rocks_config and type(rocks_config.configure) == "function" and rocks_config.configure - or nil + ---@param name string + local config_hook = function(name) + if has_rocks_config and type(rocks_config.configure) == "function" then + pcall(vim.cmd.packadd, { name, bang = true }) + rocks_config.configure(name) + end + end --- HACK: For some reason, if a RockSpec contains a list --- (e.g. colorscheme = [ .. ]) then vim.deepcopy errors