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
Toggle the sidebar
<Leader>aa to show the Avante sidebar, or run :AvanteAskFocus the sidebar
<Leader>af to switch focus between the sidebar and your codeClose the sidebar
q or <Esc> when focused on the sidebarAsking Questions About Your Code
Chat with Current File
Open a code file
Start a chat
:AvanteAsk or press <Leader>aaBy default, the current file is automatically added to the chat context when behaviour.auto_add_current_file = trueType your question
Submit
<CR> in normal mode or <C-s> in insert mode to submitAsk About Specific Lines
You can ask questions about specific line ranges:Editing Code with AI
Edit Selected Code
Select code in visual mode
v, V, or <C-v>) to select the code you want to modifyTrigger edit mode
<Leader>ae or run :AvanteEditDescribe the changes
Review and apply
a- Apply changes at cursorA- Apply all changes- Press
]xand[xto navigate between conflicts
Apply AI Suggestions
When the AI suggests code changes, you’ll see diff markers: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
@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
@codebase to enable repository mapping and project-wide context.@diagnostics - Include error information
@diagnostics - Include error information
@diagnostics to include LSP diagnostics (errors, warnings) in the context.@quickfix - Add quickfix files
@quickfix - Add quickfix files
@quickfix to add all files from the quickfix list to the chat context.@buffers - Add all open buffers
@buffers - Add all open buffers
@buffers to add all currently open buffers to the chat context.Manual File Management
Add current buffer
<Leader>ac to add the current buffer to selected filesAdd all buffers
<Leader>aB to add all open buffers to selected filesAdd file from sidebar
@ when focused on the sidebar to open the file selectorRemove a file
d while hovering over a file in the “Selected Files” sectionUsing Slash Commands
Slash commands (starting with/) provide quick access to common operations:
Examples
Using Shortcuts
Shortcuts (starting with#) provide quick access to predefined prompts:
Chat History Management
Working with Multiple Chats
Start a new chat
<Leader>an or run :AvanteChatNewBrowse chat history
<Leader>ah or run :AvanteHistory to see previous chatsNavigate between prompts
]p and [p to move between prompts in the current chatClear current chat
:AvanteClear to clear the current chat historySwitching Between Windows
When the sidebar is open:Token Counting
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
Use Context
@file or mentions to get better responses.Review Changes
Start Fresh
/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.