Module: avante
Main module accessible via require('avante').
setup(opts)
Initialize Avante.nvim with configuration options. Parameters:opts(table|nil) - Configuration options (see Configuration Schema)
get(current)
Get the current sidebar, selection, and suggestion instances for the active tab. Parameters:current(boolean|nil) - Iffalse, doesn’t update the global current state (default:true)
sidebar(avante.Sidebar) - Current sidebar instanceselection(avante.Selection) - Current selection instancesuggestion(avante.Suggestion) - Current suggestion instance
toggle()
Toggle the Avante sidebar visibility. Returns:boolean-trueif sidebar is now open,falseif closed
toggle_sidebar(opts)
Toggle sidebar with options. Parameters:opts(AskOptions|nil) - Options for sidebar behavior
is_sidebar_open()
Check if the sidebar is currently open. Returns:boolean-trueif sidebar is open
open_sidebar(opts)
Open the Avante sidebar. Parameters:opts(AskOptions|nil) - Options for opening
close_sidebar()
Close the Avante sidebar. Example:toggle.debug()
Toggle debug mode on/off. Example:toggle.selection()
Toggle selection mode on/off. Example:toggle.suggestion()
Toggle auto-suggestions on/off. Example:register_acp_client(client_id, client)
Register an ACP (Agent Client Protocol) client for cleanup on exit. Parameters:client_id(string) - Unique identifier for the clientclient(any) - ACP client instance
unregister_acp_client(client_id)
Unregister an ACP client. Parameters:client_id(string) - Unique identifier for the client
cleanup_all_acp_clients()
Cleanup all registered ACP clients (called automatically on exit). Example:Module: avante.api
API module accessible via require('avante.api').
ask(opts)
Ask AI about code or start a chat session. Parameters:opts(AskOptions|string|nil) - Options or question string
question(string|nil) - Question to askwin(table|nil) - Window options (similar tonvim_open_win)ask(boolean|nil) - Enable ask mode (default:true)floating(boolean|nil) - Use floating window for inputnew_chat(boolean|nil) - Start new chat sessionwithout_selection(boolean|nil) - Don’t include current selectionsidebar_pre_render(function|nil) - Callback before renderingsidebar_post_render(function|nil) - Callback after renderingproject_root(string|nil) - Override project rootshow_logo(boolean|nil) - Show Avante logo
zen_mode()
Open Avante in zen mode (full-screen chat experience). Example:edit(request, line1, line2)
Edit selected code block with AI assistance. Parameters:request(string|nil) - Editing instructionline1(integer|nil) - Start line (from visual selection)line2(integer|nil) - End line (from visual selection)
refresh(opts)
Refresh Avante windows to sync with current buffer. Parameters:opts(AskOptions|nil) - Refresh options
focus(opts)
Switch focus between sidebar and code window. Parameters:opts(AskOptions|nil) - Focus options
build(opts)
Build Avante.nvim dependencies. Parameters:opts(table|nil) - Build optionssource(boolean) - Build from source (default:false)
switch_provider(target)
Switch the active AI provider. Parameters:target(string) - Provider name (e.g., “claude”, “openai”, “gemini”)
switch_selector_provider(target_provider)
Switch the selector provider (e.g., telescope, fzf_lua). Parameters:target_provider(string) - Selector provider name
switch_input_provider(target_provider)
Switch the input provider (native, dressing, snacks). Parameters:target_provider(string) - Input provider name
select_model()
Open the model selector UI. Example:select_history()
Open the chat history selector. Example:add_buffer_files()
Add all open buffers to the selected files list. Example:add_selected_file(filepath)
Add a specific file to the chat context. Parameters:filepath(string) - Path to the file
remove_selected_file(filepath)
Remove a file or directory from the chat context. Parameters:filepath(string) - Path to the file or directory
stop()
Stop the current AI request. Example:get_suggestion()
Get the current suggestion instance. Returns:avante.Suggestion|nil- Current suggestion instance
API Summary
Main Module (avante)
| Function | Description |
|---|---|
setup(opts) | Initialize plugin |
get(current) | Get current instances |
toggle() | Toggle sidebar |
is_sidebar_open() | Check sidebar state |
open_sidebar(opts) | Open sidebar |
close_sidebar() | Close sidebar |
toggle.debug() | Toggle debug mode |
toggle.selection() | Toggle selection mode |
toggle.suggestion() | Toggle auto-suggestions |
register_acp_client(id, client) | Register ACP client |
unregister_acp_client(id) | Unregister ACP client |
cleanup_all_acp_clients() | Cleanup all ACP clients |
API Module (avante.api)
| Function | Description |
|---|---|
ask(opts) | Ask AI or start chat |
zen_mode() | Full-screen chat mode |
edit(request, line1, line2) | Edit code with AI |
refresh(opts) | Refresh windows |
focus(opts) | Switch focus |
build(opts) | Build dependencies |
switch_provider(target) | Switch AI provider |
switch_selector_provider(target) | Switch selector UI |
switch_input_provider(target) | Switch input UI |
select_model() | Open model selector |
select_history() | Open history selector |
add_buffer_files() | Add all buffers |
add_selected_file(filepath) | Add file to context |
remove_selected_file(filepath) | Remove file from context |
stop() | Stop AI request |
get_suggestion() | Get suggestion instance |