Skip to content

Configuring the Inline Assistant

Inline Assistant

CodeCompanion provides an inline strategy for quick, direct interaction with your code. Unlike the chat buffer, the inline assistant integrates responses directly into the current buffer—allowing the LLM to add or replace code as needed.

Keymaps

The inline assistant supports keymaps for accepting or rejecting changes:

lua
require("codecompanion").setup({
  strategies = {
    inline = {
      keymaps = {
        accept_change = {
          modes = { n = "ga" },
          description = "Accept the suggested change",
        },
        reject_change = {
          modes = { n = "gr" },
          description = "Reject the suggested change",
        },
      },
    },
  },
}),

In this example, <leader>a (or ga on some keyboards) accepts inline changes, while gr rejects them.

Layout

If the inline prompt creates a new buffer, you can also customize if this should be output in a vertical/horizontal split or a new buffer:

lua
require("codecompanion").setup({
  display = {
    inline = {
      layout = "vertical", -- vertical|horizontal|buffer
    },
  }
}),

Diff

Please see the Diff section on the Chat Buffer page for configuration options.

Released under the MIT License.