Skip to content

Commit 5c54a7e

Browse files
committed
fix: restrict close keybinding to normal mode only
Fixes #494 The close keybinding ('q') was mapped in both normal and insert modes, causing the window to close when typing words containing 'q' in the input prompt.
1 parent fc56770 commit 5c54a7e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lua/chatgpt/flows/chat/base.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,14 +1540,10 @@ function Chat:open()
15401540
end)
15411541
end, { self.chat_input }, { "i" })
15421542

1543-
-- close
1543+
-- close (normal mode only - allow typing 'q' in insert mode)
15441544
self:map(Config.options.chat.keymaps.close, function()
15451545
self:hide()
1546-
-- If current in insert mode, switch to insert mode
1547-
if vim.fn.mode() == "i" then
1548-
vim.api.nvim_command("stopinsert")
1549-
end
1550-
end)
1546+
end, nil, { "n" })
15511547

15521548
-- close_n
15531549
if Config.options.chat.keymaps.close_n then

0 commit comments

Comments
 (0)