From 8bec14aa361e08bb1c3f19d0b6385f83d068e6dc Mon Sep 17 00:00:00 2001 From: Oli Morris Date: Sun, 4 Feb 2024 22:07:21 +0000 Subject: [PATCH] docs: update README.md --- README.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0cedbf60..d1e12992 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ Use the

Chat bufferchat buffer

-

Code authorcode author

-

Code advisorcode advisorcode advisor

+

Code authorcode author

+

Code advisorcode advisorcode advisor

@@ -88,7 +88,7 @@ use({ Click to see the default configuration ```lua -{ +require("codecompanion").setup({ api_key = "OPENAI_API_KEY", -- Your API key org_api_key = "OPENAI_ORG_KEY", -- Your organisation API key base_url = "https://api.openai.com", -- The URL to use for the API requests @@ -118,16 +118,17 @@ use({ height = 10, }, chat = { -- Options for the chat strategy - type = "buffer", -- buffer|float + type = "float", -- float|buffer show_settings = false, -- Show the model settings in the chat window - float = { + float = { -- Options for the floating window border = "single", + buflisted = false, max_height = 0, max_width = 0, padding = 1, }, }, - win_options = { + win_options = { -- Options for the chat buffer cursorcolumn = false, cursorline = false, foldcolumn = "0", @@ -139,10 +140,11 @@ use({ }, }, keymaps = { + [""] = "keymaps.save", -- Save the chat buffer and trigger the API [""] = "keymaps.close", -- Close the chat buffer ["q"] = "keymaps.cancel_request", -- Cancel the currently streaming request ["gc"] = "keymaps.clear", -- Clear the contents of the chat - ["ga"] = "keymaps.codeblock", -- Insert a codeblock in the chat + ["ga"] = "keymaps.codeblock", -- Insert a codeblock into the chat ["gs"] = "keymaps.save_conversation", -- Save the current chat as a conversation ["]"] = "keymaps.next", -- Move to the next header in the chat ["["] = "keymaps.previous", -- Move to the previous header in the chat @@ -150,8 +152,9 @@ use({ log_level = "ERROR", -- TRACE|DEBUG|ERROR send_code = true, -- Send code context to the API? show_token_count = true, -- Show the token count for the current chat? + silence_notifications = false, -- Silence notifications for actions like saving conversations? use_default_actions = true, -- Use the default actions in the action palette? -} +}) ``` @@ -236,8 +239,9 @@ The chat buffer is where you can converse with your GenAI API, directly from Neo When in the chat buffer, there are number of keymaps available to you (which can be changed in the config): +- `` - Save the buffer and trigger a response from the GenAI - `` - Close the buffer -- `q` - Cancel streaming from the API +- `q` - Cancel streaming from the GenAI - `gc` - Clear the buffer's contents - `ga` - Add a codeblock - `gs` - Save the chat as a conversation @@ -246,11 +250,11 @@ When in the chat buffer, there are number of keymaps available to you (which can #### Conversations -Chat Buffers are not automatically saved to disk, owing to them being an `acwrite` buftype (see `:h buftype`). However, the plugin allows for this via the notion of Conversations and pressing `gs` in the buffer. Conversations can then be restored via the Action Palette and the _Load conversations_ action. +Chat Buffers are not automatically saved to disk, owing to them being an `acwrite` buffer (see `:h buftype`). However, the plugin allows for this via the notion of Conversations. By pressing `gs` in the buffer, the current chat will be saved. Conversations can then be restored via the Action Palette and the _Load conversations_ action. #### Settings -If `display.chat.show_settings` is set to `true`, at the very top of the chat buffer will be the parameters which can be changed to affect the API's response back to you. This enables fine-tuning and parameter tweaking throughout the chat. You can find more detail about them by moving the cursor over them or referring to the [Chat Completions reference guide](https://platform.openai.com/docs/api-reference/chat) if you're using OpenAI. +If `display.chat.show_settings` is set to `true`, at the very top of the chat buffer will be the GenAI parameters which can be changed to affect the API's response back to you. This enables fine-tuning and parameter tweaking throughout the chat. You can find more detail about them by moving the cursor over them or referring to the [Chat Completions reference guide](https://platform.openai.com/docs/api-reference/chat) if you're using OpenAI. ### In-Built Actions @@ -266,6 +270,10 @@ Both of these actions utilise the `chat` strategy. The `Chat` action opens up a > **Note**: Both of these actions allow for visually selected code to be sent to the chat buffer as code blocks. +#### Open chats + +This action enables users to easily navigate between their open chat buffers. A chat buffer maybe deleted (and removed from this action) by pressing `` when in the chat buffer. + #### Code author This action utilises the `author` strategy. This action can be useful for generating code or even refactoring a visual selection based on a prompt by the user. The action is designed to write code for the buffer filetype that it is initated in, or, if run from a terminal prompt, to write commands. @@ -311,7 +319,7 @@ vim.api.nvim_create_autocmd({ "User" }, { ### Heirline.nvim -If you use the fantastic [Heirline.nvim](https://github.com/rebelot/heirline.nvim) plugin, consider the following snippet to display an icon in the statusline whilst CodeCompanion is speaking to the LLM: +If you use the fantastic [Heirline.nvim](https://github.com/rebelot/heirline.nvim) plugin, consider the following snippet to display an icon in the statusline whilst CodeCompanion is speaking to a GenAI model: ```lua local GenAI = {