add clear chat keybinding
This commit is contained in:
		| @@ -39,14 +39,14 @@ vim.g.gemini_api_key = "your-api-key-here" | |||||||
|  |  | ||||||
| ## Usage | ## Usage | ||||||
|  |  | ||||||
| The plugin provides three ways to interact with Gemini: | The plugin provides several ways to interact with Gemini: | ||||||
|  |  | ||||||
| 1. Command Mode: | 1. Command Mode: | ||||||
| ```vim | ```vim | ||||||
| :Gemini What is SOLID in software engineering? | :Gemini What is SOLID in software engineering? | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| 2. Simple Query (default): | 2. Simple Query: | ||||||
| - Press `<leader>gc` to open an input prompt (mnemonic: 'gemini chat') | - Press `<leader>gc` to open an input prompt (mnemonic: 'gemini chat') | ||||||
| - Type your query and press Enter | - 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 | - 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 | - Useful for code-related questions about the file you're working on | ||||||
|  |  | ||||||
|  | 4. Clear Chat History: | ||||||
|  | - Press `<leader>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 | ### Chat Window Controls | ||||||
|  |  | ||||||
| The chat window appears on the right side of your editor and provides the following controls: | The chat window appears on the right side of your editor and provides the following controls: | ||||||
|   | |||||||
| @@ -229,6 +229,15 @@ function M.setup() | |||||||
|             end |             end | ||||||
|         end) |         end) | ||||||
|     end, { desc = "Chat with Gemini AI (with buffer context)" }) |     end, { desc = "Chat with Gemini AI (with buffer context)" }) | ||||||
|  |  | ||||||
|  |     -- Set up keymapping with 'gq' for 'gemini quit/clear' | ||||||
|  |     vim.keymap.set("n", "<leader>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 | end | ||||||
|  |  | ||||||
| return M | return M | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user