From 2dfccd7b948beb26d8bcff7f9113a3a5c85cbc4a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 8 Jul 2024 07:28:02 +0200 Subject: [PATCH] fix(ui): don't treat suspended as headless. Closes #1626 --- lua/lazy/core/config.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 083db1c..233b1fc 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -253,9 +253,10 @@ M.mapleader = nil ---@type string M.maplocalleader = nil -local headless = #vim.api.nvim_list_uis() == 0 +M.suspended = false + function M.headless() - return headless + return not M.suspended and #vim.api.nvim_list_uis() == 0 end ---@param opts? LazyConfig @@ -338,6 +339,12 @@ function M.setup(opts) end end, }) + + vim.api.nvim_create_autocmd({ "VimSuspend", "VimResume" }, { + callback = function(ev) + M.suspended = ev.event == "VimSuspend" + end, + }) end, }) end