Skip to main content

Overview

Avante.nvim supports multiple input providers for user input dialogs (like API key entry). You can choose between the native vim input, enhanced UI libraries, or create your own custom provider.

Available Providers

Native (Default)

Uses vim’s built-in vim.ui.input for input dialogs.
Pros:
  • No additional dependencies
  • Simple and lightweight
  • Always available
Cons:
  • Basic UI
  • Limited customization

Dressing.nvim

stevearc/dressing.nvim provides enhanced input UI with better styling and features.
1

Install dressing.nvim

2

Configure Avante

Pros:
  • Better visual styling
  • More customization options
  • Works with other plugins using vim.ui
Configuration Example:

folke/snacks.nvim provides a modern, feature-rich input UI.
1

Install snacks.nvim

2

Configure Avante

Pros:
  • Modern, polished UI
  • Rich customization
  • Consistent with other snacks.nvim features
  • Great visual feedback
Full Configuration Example:

Custom Input Provider

Create a completely custom input provider by providing a function:

Custom Provider Example

Input Provider Parameters

When creating a custom provider, you receive an input object with:
string
The title/prompt for the input dialogExample: "Enter API Key"
string
Default value to pre-fill in the inputExample: "sk-..."
boolean
Whether to conceal the input (for passwords/API keys)When true, display asterisks instead of actual characters
function
Callback function to call with the resultSignature: fun(result: string|nil): nil
  • Pass the user’s input as a string
  • Pass nil if cancelled

Provider Comparison

When to Use Each Provider

Use when:
  • You want minimal dependencies
  • You prefer simplicity over aesthetics
  • You’re running Neovim in limited environments
Example: Remote servers, minimal configs
Use when:
  • You already use dressing.nvim
  • You want consistent vim.ui behavior
  • You need good customization without complexity
Example: Standard Neovim setups with dressing already installed
Use when:
  • You have very specific requirements
  • You want complete control over behavior
  • You’re integrating with other custom UI
Example: Unique workflows, special validation needs

Example Use Cases

API Key Entry with Snacks

Simple Input with Dressing

Custom Input with Validation

Troubleshooting

  1. Verify the provider is installed (dressing/snacks)
  2. Check provider configuration is correct
  3. Look for errors in :messages
  4. Try switching to "native" to test
  1. Ensure you’re calling on_submit with a result
  2. Verify the function signature matches expectations
  3. Check for errors in your custom logic
  4. Test with a simple implementation first
  1. Check provider_opts are correct for your provider
  2. Verify colorscheme compatibility
  3. Review provider’s documentation for options
  4. Try default options first, then customize

Best Practices

Start Simple

Begin with native or dressing, then move to snacks or custom if needed.

Consistent Experience

Use the same provider across your config for consistency.

Handle Cancellation

Always handle the case where users cancel input (nil result).

Visual Feedback

Use appropriate icons and titles to help users understand what’s being requested.

Configuration

General Avante configuration

Providers

Configure AI providers and API keys