From 7b9b476a6238a53062c1c8e4331fcef054bb8761 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 23 Dec 2022 07:35:44 +0100 Subject: [PATCH] fix(install): make sure to setup loaders before attempting install so colorscheme can load. Fixes #122 --- lua/lazy/core/loader.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 481c02b..b749da2 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -11,23 +11,6 @@ M.init_done = false M.disabled_rtp_plugins = { packer_compiled = true } function M.setup() - -- install missing plugins - if Config.options.install.missing then - Util.track("install") - for _, plugin in pairs(Config.plugins) do - if not plugin._.installed then - for _, colorscheme in ipairs(Config.options.install.colorscheme) do - if pcall(vim.cmd.colorscheme, colorscheme) then - break - end - end - require("lazy.manage").install({ wait = true }) - break - end - end - Util.track() - end - -- setup handlers Util.track("handlers") Handler.setup() @@ -45,6 +28,23 @@ function M.setup() -- autoload opt plugins table.insert(package.loaders, M.autoload) + + -- install missing plugins + if Config.options.install.missing then + Util.track("install") + for _, plugin in pairs(Config.plugins) do + if not plugin._.installed then + for _, colorscheme in ipairs(Config.options.install.colorscheme) do + if pcall(vim.cmd.colorscheme, colorscheme) then + break + end + end + require("lazy.manage").install({ wait = true }) + break + end + end + Util.track() + end end -- Startup sequence