ScriptsJul 6, 2026·3 min read

Avante.nvim — AI-Powered Code Editing in Neovim

A Neovim plugin that brings AI-assisted code suggestions, inline edits, and chat-driven refactoring directly into the editor using Claude, GPT, or local models.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 29/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Stage only
Trust
Trust: Established
Entrypoint
Avante.nvim
Safe staging command
npx -y tokrepo@latest install 4d5a73dc-7937-11f1-9bc6-00163e2b0d79 --target codex

Stages files first; activation requires review of the staged README and plan.

Introduction

Avante.nvim is a Neovim plugin that integrates large language models into the editing workflow. It provides a sidebar chat interface, inline code suggestions with diff previews, and the ability to apply AI-generated edits directly to your buffer with a single keystroke.

What Avante.nvim Does

  • Opens a sidebar panel for conversing with an LLM about the current file or selection
  • Generates code edits and displays them as inline diffs before applying
  • Supports multiple AI providers including Claude, OpenAI, Azure, Gemini, and local models
  • Provides context-aware suggestions using the current buffer, selection, and project files
  • Integrates with Neovim's built-in LSP for code-aware completions and diagnostics

Architecture Overview

Avante.nvim is written in Lua with a Rust core module compiled via make for performance-critical parsing. The plugin hooks into Neovim's buffer events and uses tree-sitter for code structure awareness. API calls to LLM providers are made asynchronously, and responses are streamed token-by-token into the sidebar or diff view. Edit suggestions are parsed into hunks and applied through Neovim's buffer API.

Self-Hosting & Configuration

  • Requires Neovim 0.10+ and a C compiler for the native module build step
  • Set your API key via environment variable (e.g., ANTHROPIC_API_KEY) or in the config
  • Configure the provider and model in the opts table passed to the plugin
  • Customize keybindings for sidebar toggle, apply edit, and accept/reject diff
  • Optionally point to a local model endpoint (Ollama, LM Studio) for offline use

Key Features

  • Inline diff view lets you review and selectively apply AI-suggested changes
  • Multi-file context allows referencing other project files in conversations
  • Image paste support for vision-capable models to discuss UI screenshots
  • Conversation history persists across sessions per project
  • Extensible prompt templates for custom workflows like code review or documentation

Comparison with Similar Tools

  • Copilot.vim — GitHub Copilot integration; autocomplete-focused, no sidebar chat
  • Codeium.vim — free AI autocomplete; faster suggestions but no interactive editing
  • ChatGPT.nvim — simple chat interface; lacks inline diff and edit application
  • Cody (Neovim) — Sourcegraph AI with codebase context; different context retrieval model
  • Codecompanion.nvim — modular AI plugin for Neovim; more configurable but requires more setup

FAQ

Q: Which AI provider should I use? A: Claude and GPT-4 produce the best results for complex edits. For privacy-sensitive work, configure a local model via Ollama.

Q: Does Avante send my entire codebase to the API? A: No. It sends only the current buffer contents, selected text, and any files you explicitly reference in the conversation.

Q: Can I use Avante with lazy.nvim? A: Yes. Avante is designed for lazy.nvim and includes a build step that compiles the Rust module on install.

Q: How do I apply only part of a suggested diff? A: Use the hunk navigation keys to step through individual changes and accept or reject each one independently.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets