Before You Begin
Make sure you’ve completed the Installation steps and have Avante.nvim installed in your Neovim setup.Step 1: Set Up Your API Key
Choose Your AI Provider
Avante.nvim supports multiple AI providers. For this quickstart, we’ll use Claude, but you can choose any supported provider:
- Claude (Anthropic)
- OpenAI (GPT-4, etc.)
- Azure OpenAI
- Gemini (Google)
- Copilot
- Ollama (local models)
- And many more!
Get Your API Key
For Claude, get your API key from Anthropic’s website.For other providers, visit their respective platforms to obtain API keys.
Step 2: Configure Your Provider
In your Neovim configuration, set your preferred provider:Step 3: Open Neovim and Start Coding
Trigger Avante
There are several ways to interact with Avante:Option 1: Use the CommandOption 2: Use the Default KeybindingPress
<Leader>aa to show the Avante sidebar.The default
<Leader> key in Neovim is \, but many users remap it to , or <Space>.Ask the AI a Question
Once the sidebar opens, you can ask questions about your code:
- “Explain this function”
- “Refactor this code to be more efficient”
- “Add error handling to this function”
- “Write unit tests for this code”
<CR> (Enter) in normal mode or <C-s> in insert mode to submit.Step 4: Explore Key Features
Add Files to Context
You can add specific files to the AI’s context:- Press
@in the sidebar to add a file - Press
dto remove a file - Use
<Leader>acto add the current buffer - Use
<Leader>aBto add all open buffers
Use Mentions and Commands
Type@ in the input to access mentions:
@codebase- Enable project context@diagnostics- Include diagnostics information@file- Open file selector@buffers- Add open buffers
/ for slash commands:
/help- Show help message/clear- Clear chat history/new- Start a new chat/commit- Generate commit message
Visual Mode Selection
You can select code in visual mode and ask questions about it:- Enter visual mode (
vorV) - Select the code you want to ask about
- Press
<Leader>aato open Avante with the selected code
Common Workflows
Example 1: Refactoring Code
- Open the file in Neovim
- Press
<Leader>aa - Ask: “Refactor this function to use a dictionary for operations and add error handling”
- Review the AI’s suggestion
- Press
Ato apply all changes
Example 2: Writing Tests
- Select a function in visual mode
- Press
<Leader>aa - Ask: “Write unit tests for this function covering edge cases”
- Review the generated tests
- Apply the changes
Example 3: Understanding Code
- Navigate to an unfamiliar function
- Press
<Leader>aa - Ask: “Explain what this function does and its time complexity”
- Read the AI’s explanation in the sidebar
Tips for Success
Keyboard Shortcuts Reference
Here are the most common keyboard shortcuts:| Key Binding | Description |
|---|---|
<Leader>aa | Show/toggle sidebar |
<Leader>ar | Refresh sidebar |
<Leader>af | Switch sidebar focus |
A (in sidebar) | Apply all changes |
a (in sidebar) | Apply change at cursor |
r (in sidebar) | Retry request |
e (in sidebar) | Edit request |
q (in sidebar) | Close sidebar |
@ (in sidebar) | Add file to context |
d (in sidebar) | Remove file from context |
Next Steps
Congratulations! You’ve completed your first AI-assisted coding session with Avante.nvim. Here’s what to explore next:- Configuration: Dive deeper into configuration options to customize Avante to your workflow
- Commands: Learn about all available commands and keybindings
- Providers: Explore different AI providers and their capabilities
- Advanced Features: Discover advanced features like project instructions, RAG service, and more
Troubleshooting
If you encounter issues:- Run
:checkhealth avanteto diagnose problems - Check that your API key is set correctly
- Verify your Neovim version is 0.10.1 or later
- Review the GitHub issues for known problems