diff --git a/README.md b/README.md index 2214604..246ee5a 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,14 @@ vim.g.gemini_api_key = "your-api-key-here" ## Usage -The plugin provides three ways to interact with Gemini: +The plugin provides several ways to interact with Gemini: 1. Command Mode: ```vim :Gemini What is SOLID in software engineering? ``` -2. Simple Query (default): +2. Simple Query: - Press `gc` to open an input prompt (mnemonic: 'gemini chat') - Type your query and press Enter @@ -55,6 +55,11 @@ The plugin provides three ways to interact with Gemini: - This will send your current buffer's content as context along with your query - Useful for code-related questions about the file you're working on +4. Clear Chat History: +- Press `gq` to clear the chat history (mnemonic: 'gemini quit') +- This will clear both the chat window and conversation history +- You can also use the `:GeminiClearChat` command + ### Chat Window Controls The chat window appears on the right side of your editor and provides the following controls: diff --git a/lua/gemini/init.lua b/lua/gemini/init.lua index c2930d8..74e14cd 100644 --- a/lua/gemini/init.lua +++ b/lua/gemini/init.lua @@ -229,6 +229,15 @@ function M.setup() end end) end, { desc = "Chat with Gemini AI (with buffer context)" }) + + -- Set up keymapping with 'gq' for 'gemini quit/clear' + vim.keymap.set("n", "gq", function() + api.clear_conversation() + if chat_bufnr and vim.api.nvim_buf_is_valid(chat_bufnr) then + vim.api.nvim_buf_set_lines(chat_bufnr, 0, -1, false, {}) + end + vim.notify("Chat history cleared", vim.log.levels.INFO) + end, { desc = "Clear Gemini chat history" }) end return M