Skip to content

Using the UI ​

CodeCompanion changes as little of your UI as it can. Instead, it exposes chat metadata, highlight groups and events for you to build on. See Extending the UI for examples.

Metadata ​

_G.codecompanion_chat_metadata holds the state of every open chat buffer, keyed by buffer number:

KeyDescription
adapterThe adapter's name, model, model_info and type
config_optionsThe agent's configuration options, for ACP adapters
context_itemsNumber of context items in the chat
cyclesNumber of turns, from your message to the LLM's response
idThe chat's ID
tokensRunning total of tokens
toolsNumber of tools in the chat

_G.codecompanion_current_context holds the number of the buffer that #{buffer} points at.

The video at the top of this page shows the metadata in a statusline.

Highlight Groups ​

Every group links to a built-in group by default, so your colourscheme styles it until you override it.

Chat buffer

GroupDescription
CodeCompanionChatHeaderHeaders
CodeCompanionChatSeparatorSeparators between headers
CodeCompanionChatInfoInformation messages
CodeCompanionChatWarnWarning messages
CodeCompanionChatErrorError messages
CodeCompanionChatSubtextText under an information, warning or error message
CodeCompanionChatTokensVirtual text showing the token count
CodeCompanionChatFoldFolds, except for tool output
CodeCompanionChatEditorContextEditor context, such as #{buffer}
CodeCompanionChatToolTools, such as @{agent}
CodeCompanionChatToolTextTool output, overriding markdown rendering
CodeCompanionChatToolPendingA tool waiting to run
CodeCompanionChatToolInProgressA running tool
CodeCompanionChatToolSuccessThe summary of a tool that succeeded
CodeCompanionChatToolSuccessIconThe icon of a tool that succeeded
CodeCompanionChatToolFailureThe summary of a tool that failed
CodeCompanionChatToolFailureIconThe icon of a tool that failed

Diffs

GroupDescription
CodeCompanionDiffAddAdded lines
CodeCompanionDiffDeleteDeleted lines
CodeCompanionDiffTextAdded words within a changed line
CodeCompanionDiffTextDeleteDeleted words within a changed line
CodeCompanionDiffBannerThe keymap banner, aligned to the right of the window
CodeCompanionDiffBannerInlineThe keymap banner, on its own line above the diff

Code reviews

GroupDescription
CodeCompanionCodeReviewHeaderThe round summary at the top of the review window
CodeCompanionCodeReviewPathFile paths in the checklist
CodeCompanionCodeReviewAddedAdded lines
CodeCompanionCodeReviewRemovedRemoved lines
CodeCompanionCodeReviewCommentComments
CodeCompanionCodeReviewSentComments from the last review, shown above the changes that answer them

Other

GroupDescription
CodeCompanionCLIPath@path references in the CLI prompt input
CodeCompanionVirtualTextAll other virtual text

Released under the Apache-2.0 License.