Practical Usage Guide
This guide covers the essential workflows for using Avante.nvim effectively in your daily development.Getting Started
Avante.nvim provides AI-powered code assistance directly in Neovim. You can interact with it through commands, keybindings, and mentions.Opening the Sidebar
Asking Questions About Your Code
Chat with Current File
Start a chat
Run
:AvanteAsk or press <Leader>aaBy default, the current file is automatically added to the chat context when behaviour.auto_add_current_file = trueAsk About Specific Lines
You can ask questions about specific line ranges:Editing Code with AI
Edit Selected Code
Apply AI Suggestions
When the AI suggests code changes, you’ll see diff markers:| Key Binding | Action |
|---|---|
co | Choose ours (keep current) |
ct | Choose theirs (accept AI suggestion) |
ca | Choose all theirs |
cb | Choose both |
cc | Choose cursor |
]x | Next conflict |
[x | Previous conflict |
Changes are shown using diff markers similar to git conflicts. Review each change carefully before applying.
Managing Files in Chat Context
Using Mentions to Add Files
Mentions are special commands that start with@ and help you add context to your chat:
Available Mentions
@file - Add specific files
@file - Add specific files
Type This is useful when you want to discuss multiple related files together.
@file in the input and it will open a file selector to add files to the chat context.@codebase - Enable project context
@codebase - Enable project context
Use
@codebase to enable repository mapping and project-wide context.@diagnostics - Include error information
@diagnostics - Include error information
Add
@diagnostics to include LSP diagnostics (errors, warnings) in the context.@quickfix - Add quickfix files
@quickfix - Add quickfix files
Use
@quickfix to add all files from the quickfix list to the chat context.@buffers - Add all open buffers
@buffers - Add all open buffers
Use
@buffers to add all currently open buffers to the chat context.Manual File Management
Using Slash Commands
Slash commands (starting with/) provide quick access to common operations:
| Command | Description |
|---|---|
/help | Show help message with available commands |
/init | Initialize AGENTS.md based on current project |
/clear | Clear chat history |
/new | Start a new chat session |
/compact | Compact history messages to save tokens |
/lines <start>-<end> <question> | Ask about specific line ranges |
/commit | Generate commit message for changes |
Examples
Using Shortcuts
Shortcuts (starting with#) provide quick access to predefined prompts:
Chat History Management
Working with Multiple Chats
Switching Between Windows
When the sidebar is open:| Key Binding | Action |
|---|---|
<Tab> | Switch to next window |
<S-Tab> | Switch to previous window |
<Leader>af | Toggle focus between sidebar and code |
Token Counting
When
behaviour.enable_token_counting = true, Avante displays the token count for your chat.
This helps you stay within model limits and estimate API costs.Tips and Best Practices
Be Specific
Ask specific questions about what you want to know or change. The AI works better with clear instructions.
Use Context
Add relevant files to the chat context using
@file or mentions to get better responses.Review Changes
Always review AI-generated changes before applying them. Use the diff navigation keys.
Start Fresh
If the conversation gets off-track, start a new chat with
/new or <Leader>an.Advanced Usage
Project-Specific Instructions
Create anavante.md file in your project root to provide project-specific context:
Custom Prompts
You can override prompts by creating.avanterules files in your project root. See the configuration documentation for details.
Next Steps
Neo-tree Integration
Learn how to add files from the neo-tree sidebar
Blink.cmp Setup
Configure completion sources for blink.cmp users
Troubleshooting
Fix common issues and errors
Configuration
Explore all configuration options