Overview
Slash commands provide quick access to common operations within the Avante chat interface. Type/ to see available commands with auto-completion.
Slash commands are triggered by typing
/ followed by the command name in the Avante chat input.Available Commands
/help
Display help information about available commands and features.- List of available slash commands
- Mention triggers (
@file,@codebase, etc.) - Shortcut prefixes (
#refactor,#test, etc.) - Common keybindings
/init
Initialize AGENTS.md based on the current project structure and context.AGENTS.md or avante.md) that provides context to the AI about your project.
What it does:
- Analyzes your project structure
- Detects technologies and frameworks
- Creates a markdown file with project context
- Sets up AI persona and mission
/clear
Clear the chat history for the current session.- Context has become too large or confusing
- You want to start a new topic without previous context
- Chat is slowing down due to long history
This only clears the visible history. Use
/new if you want to start a completely new session.:AvanteClear command
/new
Start a new chat session./clear:
/clear- Removes messages but keeps the same session/new- Creates a brand new session, saving the old one
/history or :AvanteHistory to reopen previous chats.
See also: :AvanteChatNew command
/compact
Compact chat history to save tokens while preserving important context.- Reduce API costs
- Speed up AI responses
- Stay within context limits
- Maintain essential information
- Identifies older, less relevant messages
- Summarizes or removes redundant information
- Preserves key decisions and important context
- Updates the chat history with compacted version
/lines
Ask a question about specific line ranges in the current file.<start>- Starting line number<end>- Ending line number<question>- Your question about those lines
/commit
Generate a commit message for the current staged changes.- Analyzes
git diff --staged - Understands the nature of changes
- Generates a descriptive commit message
- Follows conventional commit format (if configured)
Ensure you have staged changes before using
/commit. The AI analyzes only staged changes, not all modifications.git_commit tool in LLM Tools
/history
Open the chat session selector to view and reopen previous conversations.- View list of past chat sessions
- See session timestamps and first messages
- Reopen any previous conversation
- Continue from where you left off
:AvanteHistory command and <Leader>ah keybinding
Usage in nvim-cmp / blink.cmp
Slash commands appear automatically in completion menus when you type/:
Command Aliases
Some commands have equivalent vim commands:| Slash Command | Vim Command | Keybinding |
|---|---|---|
/clear | :AvanteClear | - |
/new | :AvanteChatNew | <Leader>an |
/history | :AvanteHistory | <Leader>ah |
/commit | (uses git_commit tool) | - |
Combining with Mentions and Shortcuts
You can combine slash commands with mentions and shortcuts:Creating Custom Commands
While you can’t add new slash commands directly, you can create similar functionality using:-
Custom Shortcuts (triggered with
#): - Custom Tools for complex operations: See LLM Tools for examples.
-
Vim Commands for integration:
Best Practices
Use /clear Wisely
Clear history when context becomes muddled, but remember you lose all previous context.
Session Management
Use
/new to organize work by feature or task, making it easier to return to specific conversations.Token Management
Use
/compact regularly during long sessions to control costs and improve performance.Precise Questions
Use
/lines to focus the AI on specific code sections for more targeted responses.Troubleshooting
Slash commands not appearing
Slash commands not appearing
- Ensure nvim-cmp or blink.cmp is installed
- Verify completion source is configured:
- Check that you’re in the Avante chat input
/commit not working
/commit not working
- Ensure you have staged changes:
git add <files> - Check git is installed and working
- Verify you’re in a git repository
/lines gives wrong code
/lines gives wrong code
Make sure the line numbers are correct and within the file’s range. Line numbers are 1-indexed.
/compact removes too much
/compact removes too much
This is expected behavior. If you need more control, use
/clear to fully reset or /new to start a fresh session.Related Documentation
Completion Sources
Learn about mentions and shortcuts
Commands
All available vim commands
LLM Tools
Explore available tools for the AI