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
| Key Binding | Description |
|---|---|
co | Choose Ours - Keep your current code |
ct | Choose Theirs - Accept AI’s suggestion |
cb | Choose Both - Keep both versions |
ca | Choose All Theirs - Accept all AI suggestions |
cc | Choose Cursor - Use version under cursor |
Navigation
| Key Binding | Description |
|---|---|
]x | Next Conflict - Jump to next conflict |
[x | Previous Conflict - Jump to previous conflict |
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: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 thetimeoutlen setting while hovering over a diff:
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
| Highlight Group | Description | Default |
|---|---|---|
AvanteConflictCurrent | Current code highlight | DiffText |
AvanteConflictIncoming | AI suggestion highlight | DiffAdd |
AvanteConflictCurrentLabel | Current code label | Shade of AvanteConflictCurrent |
AvanteConflictIncomingLabel | AI suggestion label | Shade of AvanteConflictIncoming |
List Opener
Configure how the conflict list is opened:Focus After Apply
Control which diff to focus after applying changes: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:Workflow Example
Review Conflicts
The AI’s suggestions appear as conflicts. Review the differences between “ours” (current) and “theirs” (AI).
Resolve Conflicts
For each conflict, choose:
co- Keep your versionct- Accept AI’s versioncb- Keep bothcc- Use version under cursor
Auto-Apply Mode
For faster workflows, enable auto-apply to skip conflict resolution: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
Keybindings not working
Keybindings not working
- Ensure
behaviour.auto_set_keymaps = truein your config - Check for keybinding conflicts with other plugins
- Verify you’re in the diff buffer when pressing keys
Cannot see conflicts
Cannot see conflicts
- Ensure
behaviour.auto_set_highlight_group = true - Check your colorscheme supports diff highlights
- Try customizing
highlights.diffsettings
Autojump not working
Autojump not working
Verify
diff.autojump = true in your configuration.Related Documentation
Keybindings
View all available keybindings
Usage Guide
Learn basic Avante workflows
Highlights
Customize visual appearance