User Interface
CodeCompanion aims to keep any changes to the user's UI to a minimum. Aesthetics, especially in Neovim, are highly subjective. So whilst it won't set much by default, it does endeavour to allow users to hook into the plugin and customize the UI to their liking via Events.
Metadata
CodeCompanion exposes a global dictionary, _G.codecompanion_chat_metadata which users can leverage throughout their configuration. Using the chat buffer's buffer number as the key, the dictionary contains:
adapter- Thenameandmodelof the chat buffer's current adaptercontext_items- The number of context items current in the chat buffercycles- The number of cycles (User->LLM->User) that have taken place in the chat bufferid- The ID of the chat buffertokens- The running total of tokens for the chat buffertools- The number of tools in the chat buffer
You can also leverage _G.codecompanion_current_context to fetch the number of the buffer which the #{buffer} variable points at.
Below are some examples of how you can customize the UI related to CodeCompanion.
Highlight Groups
The plugin sets the following highlight groups during setup:
CodeCompanionChatInfo- Information messages in the chat bufferCodeCompanionChatInfoBanner- Banner showing useful information in the chat bufferCodeCompanionChatError- Error messages in the chat bufferCodeCompanionChatWarn- Warning messages in the chat bufferCodeCompanionChatSubtext- Messages that appear under the information, error or warning messages in the chat bufferCodeCompanionChatFold- For any folds in the chat buffer (not including tool output)CodeCompanionChatHeader- The headers in the chat bufferCodeCompanionChatSeparator- Separator between headings in the chat bufferCodeCompanionSuperDiffDirectory- Highlight directories in a Super Diff bufferCodeCompanionSuperDiffFilename- Highlight filenames in a Super Diff bufferCodeCompanionChatTokens- Virtual text in the chat buffer showing the token countCodeCompanionChatTool- Tools in the chat bufferCodeCompanionChatToolGroups- Tool groups in the chat bufferCodeCompanionChatVariable- Variables in the chat bufferCodeCompanionVirtualText- All other virtual text in the plugin