Scripts2026年7月6日·1 分钟阅读

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 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 29/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Stage only
信任
信任等级:Established
入口
Avante.nvim
安全暂存命令
npx -y tokrepo@latest install 4d5a73dc-7937-11f1-9bc6-00163e2b0d79 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产