diff --git a/lua/gemini/chat.lua b/lua/gemini/chat.lua index 608b26b..18d06bd 100644 --- a/lua/gemini/chat.lua +++ b/lua/gemini/chat.lua @@ -122,35 +122,18 @@ end local function setup_buffer_keymaps(bufnr) local opts = { buffer = bufnr, nowait = true, silent = true } - -- Block ALL leader key combinations + -- Block ALL leader key combinations - this is the key fix! vim.keymap.set({'n', 'v'}, '', function() vim.notify('Leader key commands are disabled in chat window', vim.log.levels.WARN) return '' end, opts) - -- Disable ALL commands + -- Disable command mode vim.keymap.set('n', ':', function() vim.notify('Commands are disabled in chat window', vim.log.levels.WARN) return '' end, opts) - -- Block ALL normal mode key combinations that could manipulate files - local blocked_keys = { - 'ZZ', 'ZQ', 'gf', 'f', 'gf', 'F', - 'v', 's', 'n', '', '', - '^', '6', 'gF', 'gF', - 'o', 'T', 'H', 'J', 'K', 'L', - -- Add specific telescope/file finder bindings - 'sf', 'ff', 'fg', - } - - for _, key in ipairs(blocked_keys) do - vim.keymap.set({'n', 'v', 'i'}, key, function() - vim.notify('Operation not allowed in chat window', vim.log.levels.WARN) - return '' - end, opts) - end - -- Only allow specific keymaps for chat functionality local mappings = config.options.mappings vim.keymap.set('n', mappings.close, function() @@ -166,14 +149,11 @@ local function setup_buffer_keymaps(bufnr) require("gemini").prompt_query(state.current_context) end, opts) - -- Allow only basic navigation + -- Allow basic navigation local allowed_keys = {'j', 'k', '', '', '', '', 'G', 'gg'} for _, key in ipairs(allowed_keys) do vim.keymap.set('n', key, key, opts) end - - -- Block all other keys - vim.keymap.set({'n', 'v', 'i'}, '', '', opts) end function M.create_window()