fix: recursion loading random issue

This commit is contained in:
Barrett Ruth 2026-02-10 13:44:36 -05:00
parent 9ff64a7b89
commit 130a1899c2

View file

@ -1,7 +1,12 @@
local M = {} local M = {}
local loading = false
---@return nil ---@return nil
function M.load() function M.load()
if loading then return end
loading = true
if vim.g.colors_name then if vim.g.colors_name then
vim.cmd('hi clear') vim.cmd('hi clear')
end end
@ -15,6 +20,8 @@ function M.load()
local theme = require('midnight.theme') local theme = require('midnight.theme')
theme.apply() theme.apply()
loading = false
end end
---@deprecated Use `vim.cmd('colorscheme midnight')` instead ---@deprecated Use `vim.cmd('colorscheme midnight')` instead