Skip to main content

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.
/help
Usage: Get an overview of Avante’s capabilities, keybindings, and available commands. Example Output:
  • 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.
/init
Usage: Automatically generate a project instruction file (AGENTS.md or avante.md) that provides context to the AI about your project. What it does:
  1. Analyzes your project structure
  2. Detects technologies and frameworks
  3. Creates a markdown file with project context
  4. Sets up AI persona and mission
Output: Creates a customized instruction file in your project root.
Run /init when starting a new project to help the AI understand your codebase structure and conventions.

/clear

Clear the chat history for the current session.
/clear
Usage: Remove all previous messages from the current chat, starting fresh while keeping the session active. When to use:
  • 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.
See also: :AvanteClear command

/new

Start a new chat session.
/new
Usage: Create a completely new chat session. The previous session is saved and can be reopened later. Difference from /clear:
  • /clear - Removes messages but keeps the same session
  • /new - Creates a brand new session, saving the old one
Accessing old sessions: Use /history or :AvanteHistory to reopen previous chats. See also: :AvanteChatNew command

/compact

Compact chat history to save tokens while preserving important context.
/compact
Usage: Reduce the size of your chat history by summarizing older messages, which helps:
  • Reduce API costs
  • Speed up AI responses
  • Stay within context limits
  • Maintain essential information
How it works:
  1. Identifies older, less relevant messages
  2. Summarizes or removes redundant information
  3. Preserves key decisions and important context
  4. Updates the chat history with compacted version
Use /compact during long coding sessions to keep context manageable without losing important information.

/lines

Ask a question about specific line ranges in the current file.
/lines <start>-<end> <question>
Parameters:
  • <start> - Starting line number
  • <end> - Ending line number
  • <question> - Your question about those lines
Examples:
/lines 10-50 What does this function do?
/lines 100-150 How can I optimize this code?
/lines 75-90 Are there any bugs in this validation logic?
Usage: Focus the AI’s attention on a specific portion of code without selecting it manually.

/commit

Generate a commit message for the current staged changes.
/commit
Usage: Automatically create a conventional commit message based on your git changes. How it works:
  1. Analyzes git diff --staged
  2. Understands the nature of changes
  3. Generates a descriptive commit message
  4. Follows conventional commit format (if configured)
Example Output:
feat(auth): add JWT token refresh mechanism

- Implement automatic token refresh before expiration
- Add retry logic for failed refresh attempts
- Update authentication service tests
Ensure you have staged changes before using /commit. The AI analyzes only staged changes, not all modifications.
See also: The git_commit tool in LLM Tools

/history

Open the chat session selector to view and reopen previous conversations.
/history
Usage: Browse and restore previous chat sessions. What you can do:
  • View list of past chat sessions
  • See session timestamps and first messages
  • Reopen any previous conversation
  • Continue from where you left off
See also: :AvanteHistory command and <Leader>ah keybinding
Slash commands appear automatically in completion menus when you type /:
1

Type Trigger

Type / in the Avante chat input
2

See Completions

A completion menu appears showing available commands with descriptions
3

Select Command

Use arrow keys or <C-n>/<C-p> to navigate, then <CR> to select
4

Add Parameters

For commands like /lines, add the required parameters after the command

Command Aliases

Some commands have equivalent vim commands:
Slash CommandVim CommandKeybinding
/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:
/lines 50-100 @diagnostics fix these errors
/clear
@codebase #refactor the authentication module
/commit @file include these changes

Creating Custom Commands

While you can’t add new slash commands directly, you can create similar functionality using:
  1. Custom Shortcuts (triggered with #):
    shortcuts = {
      {
        name = "review",
        prompt = "Please review this code for bugs, performance issues, and best practices.",
      },
    }
    
  2. Custom Tools for complex operations: See LLM Tools for examples.
  3. Vim Commands for integration:
    command! AvanteReview lua require('avante.api').ask({prompt = "Review this code"})
    

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

  1. Ensure nvim-cmp or blink.cmp is installed
  2. Verify completion source is configured:
    sources = {
      compat = { "avante_commands" }
    }
    
  3. Check that you’re in the Avante chat input
  1. Ensure you have staged changes: git add <files>
  2. Check git is installed and working
  3. Verify you’re in a git repository
Make sure the line numbers are correct and within the file’s range. Line numbers are 1-indexed.
This is expected behavior. If you need more control, use /clear to fully reset or /new to start a fresh session.

Completion Sources

Learn about mentions and shortcuts

Commands

All available vim commands

LLM Tools

Explore available tools for the AI

Build docs developers (and LLMs) love