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