From 7ec65e4cd94425d08edcdab435372e4b67069d76 Mon Sep 17 00:00:00 2001
From: Folke Lemaitre <folke.lemaitre@gmail.com>
Date: Fri, 2 Dec 2022 19:18:10 +0100
Subject: [PATCH] feat: temporary colorscheme to use during install during
 startup

---
 lua/lazy/core/config.lua | 10 +++++++++-
 lua/lazy/core/loader.lua |  7 ++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua
index 6988342..2385f7b 100644
--- a/lua/lazy/core/config.lua
+++ b/lua/lazy/core/config.lua
@@ -10,7 +10,6 @@ M.defaults = {
     -- version = "*", -- enable this to try installing the latest stable versions of plugins
   },
   lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update.
-  install_missing = true, -- install missing plugins on startup. This doesn't increase startup time.
   concurrency = nil, -- set to a number to limit the maximum amount of concurrent tasks
   git = {
     -- defaults for `Lazy log`
@@ -30,6 +29,13 @@ M.defaults = {
     ---@type string[]
     patterns = {}, -- For example {"folke"}
   },
+  install = {
+    -- install missing plugins on startup. This doesn't increase startup time.
+    missing = true,
+    -- try to load one of the colorschemes in this list when starting an install during startup
+    -- the first colorscheme that is found will be used
+    colorscheme = { "habamax" },
+  },
   ui = {
     -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
     border = "none",
@@ -78,6 +84,8 @@ function M.setup(spec, opts)
   M.spec = spec
   M.options = vim.tbl_deep_extend("force", M.defaults, opts or {})
   M.options.performance.cache = require("lazy.core.cache")
+  table.insert(M.options.install.colorscheme, "habamax")
+
   M.root = M.options.package.path .. "/pack/" .. M.options.package.name .. "/opt"
 
   if M.options.performance.reset_packpath then
diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua
index 077cc04..e6c57e1 100644
--- a/lua/lazy/core/loader.lua
+++ b/lua/lazy/core/loader.lua
@@ -9,8 +9,13 @@ M.init_done = false
 
 function M.setup()
   -- install missing plugins
-  if Config.options.install_missing then
+  if Config.options.install.missing then
     Util.track("install")
+    for _, colorscheme in ipairs(Config.options.install.colorscheme) do
+      if pcall(vim.cmd.colorscheme, colorscheme) then
+        break
+      end
+    end
     for _, plugin in pairs(Config.plugins) do
       if not plugin._.installed then
         vim.cmd("do User LazyInstallPre")