From c963accf6497be175a715fa9da4be0cbdb0ca0e6 Mon Sep 17 00:00:00 2001 From: Tahv Demayo Date: Mon, 17 Nov 2025 09:00:01 -0800 Subject: [PATCH] Add nil check before setting window configuration --- lua/showkeys/utils.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/showkeys/utils.lua b/lua/showkeys/utils.lua index 1d18878..0cf20fa 100644 --- a/lua/showkeys/utils.lua +++ b/lua/showkeys/utils.lua @@ -55,7 +55,9 @@ local update_win_w = function() end M.gen_winconfig() - api.nvim_win_set_config(state.win, state.config.winopts) + if state.win then + api.nvim_win_set_config(state.win, state.config.winopts) + end end M.draw = function() @@ -81,9 +83,11 @@ end M.clear_and_close = function() state.keys = {} M.redraw() - local tmp = state.win - state.win = nil - api.nvim_win_close(tmp, true) + if state.win then + local tmp = state.win + state.win = nil + api.nvim_win_close(tmp, true) + end end M.parse_key = function(char)