Skip to main content

Overview

Avante.nvim provides powerful diff management capabilities inspired by git-conflict.nvim. When the AI suggests code changes, you can review and selectively apply them using intuitive keybindings.

Diff Conflict Keybindings

When viewing AI-suggested changes, you’ll see conflicts between your current code (“ours”) and the AI’s suggestions (“theirs”). Use these keybindings to resolve conflicts:

Primary Actions

These keybindings are inspired by vim-fugitive’s merge conflict resolution patterns, making them familiar to vim users.

Customizing Diff Keybindings

You can customize all diff-related keybindings in your configuration:

Custom Keybinding Example

Auto-Jump Feature

Avante can automatically jump to the first conflict when applying diffs:
boolean
default:"true"
When enabled, automatically jumps to the first conflict after a diff is applied

Timeout Configuration

To avoid conflicts with vim’s operator-pending mode, Avante can override the timeoutlen setting while hovering over a diff:
number
default:"500"
Override the timeoutlen setting while hovering over a diff to avoid entering operator-pending mode. Set to -1 to disable.
This helps prevent accidentally triggering vim’s operator-pending mode when using diff mappings that start with c.

Diff Highlights

Customize how diffs are highlighted:

Available Highlight Groups

List Opener

Configure how the conflict list is opened:
You can also use a function:

Focus After Apply

Control which diff to focus after applying changes:
string
default:"ours"
Which diff to focus after applying. Options:
  • "ours" - Focus on your current code
  • "theirs" - Focus on AI’s suggestion

Minimize Diff

Remove unchanged lines when applying code blocks:
Enabling minimize_diff makes it easier to focus on actual changes by hiding unchanged code.

Workflow Example

1

Request AI Changes

Ask the AI to modify your code using :AvanteAsk or :AvanteEdit.
2

Review Conflicts

The AI’s suggestions appear as conflicts. Review the differences between “ours” (current) and “theirs” (AI).
3

Navigate Conflicts

Use ]x and [x to jump between conflicts.
4

Resolve Conflicts

For each conflict, choose:
  • co - Keep your version
  • ct - Accept AI’s version
  • cb - Keep both
  • cc - Use version under cursor
5

Apply All (Optional)

Use ca to accept all AI suggestions at once, or A in the sidebar to apply all changes.

Auto-Apply Mode

For faster workflows, enable auto-apply to skip conflict resolution:
Auto-apply mode will automatically apply all AI suggestions without review. Use with caution.

Tips and Tricks

Quick Accept

Use ca to quickly accept all AI suggestions if you trust the changes.

Selective Review

Navigate with ]x/[x to review each conflict individually before deciding.

Hybrid Approach

Use cb to keep both versions when you want to merge ideas manually.

Cursor Control

Position your cursor on the preferred version and use cc for quick resolution.

Troubleshooting

  1. Ensure behaviour.auto_set_keymaps = true in your config
  2. Check for keybinding conflicts with other plugins
  3. Verify you’re in the diff buffer when pressing keys
  1. Ensure behaviour.auto_set_highlight_group = true
  2. Check your colorscheme supports diff highlights
  3. Try customizing highlights.diff settings
Verify diff.autojump = true in your configuration.

Keybindings

View all available keybindings

Usage Guide

Learn basic Avante workflows

Highlights

Customize visual appearance