avante.nvim README

The project's README from github.com/avante-corp/avante.nvim. As one markdown file: README.md.

logo

avante.nvim

Neovim: v0.12+ Lua CI status Rust CI status pre-commit status Discord

avante.nvim is a Neovim plugin designed to emulate the behaviour of the Cursor AI IDE. It provides users with AI-driven code suggestions and the ability to apply these recommendations directly to their source files with minimal effort.

查看中文版

[!NOTE]

🥰 This project is undergoing rapid iterations, and many exciting features will be added successively. Stay tuned!

https://github.com/user-attachments/assets/510e6270-b6cf-459d-9a2f-15b397d1fe53

https://github.com/user-attachments/assets/86140bfd-08b4-483d-a887-1b701d9e37dd

Table of contents

Sponsorship ❤️

If you like this project, please consider supporting me on Patreon, as it helps me to continue maintaining and improving it:

Sponsor me

Features

Avante Zen Mode

It is possible to launch avante such that it looks like a typical Vibe Coding Agent CLI while being Neovim underneath. At the same time, by leveraging ACP it has all capabilities of claude code / gemini-cli / codex! Why not enjoy both?

Now all you need to do is install ./contrib/avante in your PATH (or create the equivalent alias); then every time you simply type avante just like using claude code and enter Avante’s Zen Mode!

The effect is as follows:

Avante Zen Mode

Project instructions with avante.md

The `avante.md` file allows you to provide project-specific context and instructions to the ai. this file should be placed in your project root and will be automatically referenced during all interactions with avante.

Best practices for avante.md

to get the most out of your project instruction file, consider following this structure:

Your role

define the ai's persona and expertise level for your project:

### your role

you are an expert senior software engineer specializing in [technology stack]. you have deep knowledge of [specific frameworks/tools] and understand best practices for [domain/industry]. you write clean, maintainable, and well-documented code. you prioritize code quality, performance, and security in all your recommendations.

Your mission

clearly describe what the ai should focus on and how it should help:

### your mission

your primary goal is to help build and maintain [project description]. you should:

- provide code suggestions that follow our established patterns and conventions
- help debug issues by analyzing code and suggesting solutions
- assist with refactoring to improve code quality and maintainability
- suggest optimizations for performance and scalability
- ensure all code follows our security guidelines
- help write comprehensive tests for new features

Additional sections to consider

  • project context: brief description of the project, its goals, and target users
  • technology stack: list of technologies, frameworks, and tools used
  • coding standards: specific conventions, style guides, and patterns to follow
  • architecture guidelines: how components should interact and be organized
  • testing requirements: testing strategies and coverage expectations
  • security considerations: specific security requirements or constraints

example avante.md

# project instructions for myapp

## your role

you are an expert full-stack developer specializing in react, node.js, and typescript. you understand modern web development practices and have experience with our tech stack.

## your mission

help build a scalable e-commerce platform by:

- writing type-safe typescript code
- following react best practices and hooks patterns
- implementing restful apis with proper error handling
- ensuring responsive design with tailwind css
- writing comprehensive unit and integration tests

## project context

myapp is a modern e-commerce platform targeting small businesses. we prioritize performance, accessibility, and user experience.

## technology stack

- frontend: react 18, typescript, tailwind css, vite
- backend: node.js, express, prisma, postgresql
- testing: jest, react testing library, playwright
- deployment: docker, aws

## coding standards

- use functional components with hooks
- prefer composition over inheritance
- write self-documenting code with clear variable names
- add jsdoc comments for complex functions
- follow the existing folder structure and naming conventions

Installation

For building binary if you wish to build from source, then cargo is required. Otherwise curl and tar will be used to get prebuilt binary from GitHub.

lazy.nvim
{
  "yetone/avante.nvim",
  -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
  -- ⚠️ must add this setting! ! !
  build = vim.fn.has("win32") ~= 0
      and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
      or "make",
  event = "VeryLazy",
  version = false, -- Never set this value to "*"! Never!
  ---@module 'avante'
  ---@type avante.Config
  opts = {
    -- add any opts here
    -- this file can contain specific instructions for your project
    instructions_file = "avante.md",
    -- for example
    provider = "claude",
    providers = {
      claude = {
        endpoint = "https://api.anthropic.com",
        model = "claude-sonnet-4-20250514",
        timeout = 30000, -- Timeout in milliseconds
          extra_request_body = {
            temperature = 0.75,
            max_tokens = 20480,
          },
      },
      moonshot = {
        endpoint = "https://api.moonshot.ai/v1",
        model = "kimi-k2-0711-preview",
        timeout = 30000, -- Timeout in milliseconds
        extra_request_body = {
          temperature = 0.75,
          max_tokens = 32768,
        },
      },
    },
  },
  dependencies = {
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
    --- The below dependencies are optional,
    "nvim-mini/mini.pick", -- for file_selector provider mini.pick
    "nvim-telescope/telescope.nvim", -- for file_selector provider telescope
    "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
    "ibhagwan/fzf-lua", -- for file_selector provider fzf
    "folke/snacks.nvim", -- for input provider snacks
    "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
    "zbirenbaum/copilot.lua", -- for providers='copilot'
    {
      -- support for image pasting
      "HakonHarnes/img-clip.nvim",
      event = "VeryLazy",
      opts = {
        -- recommended settings
        default = {
          embed_image_as_base64 = false,
          prompt_for_file_name = false,
          drag_and_drop = {
            insert_mode = true,
          },
          -- required for Windows users
          use_absolute_path = true,
        },
      },
    },
    {
      -- Make sure to set this up properly if you have lazy=true
      'MeanderingProgrammer/render-markdown.nvim',
      opts = {
        file_types = { "markdown", "Avante" },
      },
      ft = { "markdown", "Avante" },
    },
  },
}
Pack

Pack is an out-of-the-box plugin manager since Neovim v0.12.

vim.api.nvim_create_autocmd(
  'PackChanged',
  {
    callback = function(ev)
      local name, kind = ev.data.spec.name, ev.data.kind
      if name == 'avante.nvim' and (kind == 'install' or kind == 'update') then
        -- Use `./build.sh` to use prebuilt libraries
        vim.system({ 'make' }, { cwd = ev.data.path }):wait()
      end
    end
  }
)

vim.pack.add({
  {
    src='https://github.com/yetone/avante.nvim',
    version='main'  -- default
  },

  -- Deps
  'https://github.com/nvim-lua/plenary.nvim',
  'https://github.com/MunifTanjim/nui.nvim',

  -- Optional deps
  'https://github.com/MeanderingProgrammer/render-markdown.nvim',
  'https://github.com/hrsh7th/nvim-cmp',
  'https://github.com/nvim-tree/nvim-web-devicons', -- or 'echasnovski/mini.icons'
  'https://github.com/HakonHarnes/img-clip.nvim',
  'https://github.com/zbirenbaum/copilot.lua',
  'https://github.com/folke/snacks.nvim', -- for modern input UI
})

-- Config customizations
require('avante').setup({})
rocks.nvim

Run :Rocks install avante.nvim then add to your init.lua:

require('avante').setup()
vim-plug

call plug#begin()

" Deps
Plug 'nvim-lua/plenary.nvim'
Plug 'MunifTanjim/nui.nvim'
Plug 'MeanderingProgrammer/render-markdown.nvim'

" Optional deps
Plug 'hrsh7th/nvim-cmp'
Plug 'nvim-tree/nvim-web-devicons' "or Plug 'echasnovski/mini.icons'
Plug 'HakonHarnes/img-clip.nvim'
Plug 'zbirenbaum/copilot.lua'
Plug 'folke/snacks.nvim' " for modern input UI

" Yay, pass source=true if you want to build from source
Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': 'make' }

call plug#end()

autocmd! User avante.nvim
lua << EOF
require('avante').setup({})
EOF
mini.deps
local add, later, now = MiniDeps.add, MiniDeps.later, MiniDeps.now

add({
  source = 'yetone/avante.nvim',
  monitor = 'main',
  depends = {
    'nvim-lua/plenary.nvim',
    'MunifTanjim/nui.nvim',
    'echasnovski/mini.icons'
  },
  hooks = { post_checkout = function() vim.cmd('make') end }
})
--- optional
add({ source = 'hrsh7th/nvim-cmp' })
add({ source = 'zbirenbaum/copilot.lua' })
add({ source = 'HakonHarnes/img-clip.nvim' })
add({ source = 'MeanderingProgrammer/render-markdown.nvim' })

later(function() require('render-markdown').setup({...}) end)
later(function()
  require('img-clip').setup({...}) -- config img-clip
  require("copilot").setup({...}) -- setup copilot to your liking
  require("avante").setup({...}) -- config for avante.nvim
end)
Home Manager
programs.neovim = {
  plugins = [
    {
      plugin = pkgs.vimPlugins.avante-nvim;
      type = "lua";
      config = ''
              require("avante").setup()
      ''; # or builtins.readFile ./plugins/avante.lua
    }
  ];
};
Nixvim
  plugins.avante.enable = true;
  plugins.avante.settings = {
    # setup options here
  };
Lua
-- deps:
require('cmp').setup ({
  -- use recommended settings from above
})
require('img-clip').setup ({
  -- use recommended settings from above
})
require('copilot').setup ({
  -- use recommended settings from above
})
require('render-markdown').setup ({
  -- use recommended settings from above
})
require('avante').setup({
  -- Example: Using snacks.nvim as input provider
  input = {
    provider = "snacks", -- "native" | "snacks"
    provider_opts = {
      -- Snacks input configuration
      title = "Avante Input",
      icon = " ",
      placeholder = "Enter your API key...",
    },
  },
  -- Your other config here!
})

[!IMPORTANT]

avante.nvim is currently only compatible with Neovim 0.11.0 or later. Please ensure that your Neovim version meets these requirements before proceeding.

[!NOTE]

When loading the plugin synchronously, we recommend requireing it sometime after your colorscheme.

[!NOTE]

Recommended Neovim options:

-- views can only be fully collapsed with the global statusline
vim.opt.laststatus = 3

[!TIP]

Any rendering plugins that support markdown should work with Avante as long as you add the supported filetype Avante. See https://github.com/yetone/avante.nvim/issues/175 and this comment for more information.

Configuration

You can configure avante.nvim using a global variable:

vim.g.avante = {
  provider = "claude",
  behaviour = {
    auto_suggestions = false,
  },
}

You can also pass options directly to setup():

require("avante").setup({
  provider = "claude",
  behaviour = {
    auto_suggestions = false,
  },
})

If both are used, options passed to setup() override values from vim.g.avante.

Default configuration

See config.lua#L9 for the up to date full default configuration

{
  ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
  ---@type Provider
  provider = "claude", -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode
  ---@alias Mode "agentic" | "legacy"
  ---@type Mode
  mode = "agentic", -- The default mode for interaction. "agentic" uses tools to automatically generate code, "legacy" uses the old planning method to generate code.
  -- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
  -- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
  -- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
  auto_suggestions_provider = "claude",
  providers = {
    claude = {
      endpoint = "https://api.anthropic.com",
      auth_type = "api" -- Set to "max" to sign in with Claude Pro/Max subscription
      model = "claude-3-5-sonnet-20241022",
      extra_request_body = {
        temperature = 0.75,
        max_tokens = 4096,
      },
    },
  },
  ---Specify the special dual_boost mode
  ---1. enabled: Whether to enable dual_boost mode. Default to false.
  ---2. first_provider: The first provider to generate response. Default to "openai".
  ---3. second_provider: The second provider to generate response. Default to "claude".
  ---4. prompt: The prompt to generate response based on the two reference outputs.
  ---5. timeout: Timeout in milliseconds. Default to 60000.
  ---How it works:
  --- When dual_boost is enabled, avante will generate two responses from the first_provider and second_provider respectively. Then use the response from the first_provider as provider1_output and the response from the second_provider as provider2_output. Finally, avante will generate a response based on the prompt and the two reference outputs, with the default Provider as normal.
  ---Note: This is an experimental feature and may not work as expected.
  dual_boost = {
    enabled = false,
    first_provider = "openai",
    second_provider = "claude",
    prompt = "Based on the two reference outputs below, generate a response that incorporates elements from both but reflects your own judgment and unique perspective. Do not provide any explanation, just give the response directly. Reference Output 1: [{{provider1_output}}], Reference Output 2: [{{provider2_output}}]",
    timeout = 60000, -- Timeout in milliseconds
  },
  behaviour = {
    auto_suggestions = false, -- Experimental stage
    auto_set_highlight_group = true,
    auto_set_keymaps = true,
    auto_apply_diff_after_generation = false,
    support_paste_from_clipboard = false,
    minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
    enable_token_counting = true, -- Whether to enable token counting. Default to true.
    auto_add_current_file = true, -- Whether to automatically add the current file when opening a new chat. Default to true.
    auto_approve_tool_permissions = true, -- Default: auto-approve all tools (no prompts)
    -- Examples:
    -- auto_approve_tool_permissions = false,                -- Show permission prompts for all tools
    -- auto_approve_tool_permissions = {"bash", "str_replace"}, -- Auto-approve specific tools only
    ---@type "popup" | "inline_buttons"
    confirmation_ui_style = "inline_buttons",
    --- Whether to automatically open files and navigate to lines when ACP agent makes edits
    ---@type boolean
    acp_follow_agent_locations = true,
  },
  prompt_logger = { -- logs prompts to disk (timestamped, for replay/debugging)
    enabled = true, -- toggle logging entirely
    log_dir = vim.fn.stdpath("cache") .. "/avante_prompts", -- directory where logs are saved
    fortune_cookie_on_success = false, -- shows a random fortune after each logged prompt (requires `fortune` installed)
    next_prompt = {
      normal = "<C-n>", -- load the next (newer) prompt log in normal mode
      

avante.nvim (avante-corp/avante.nvim)

Searching Database…

这是什么?Avante.nvim 是一个 Neovim 插件,能让 Neovim 具备类似 Cursor AI IDE 的功能,提供由 AI 驱动的代码建议,并可直接应用到你的源代码文件中。
这是独立应用,还是我要添加到编辑器里的插件?它是一个 Neovim 插件,通过 vim-plug 之类的插件管理器安装,而不是独立应用。
我该怎么安装和配置它?通过插件管理器安装(例如 vim-plug),然后在 Lua 配置中设置 claude、openai、azure 或 gemini 等服务提供商;如果从源码构建,需要 cargo;否则使用 curl 和 tar 从 GitHub 下载预编译的二进制文件。
我需要什么版本的 Neovim,以及哪些 API 密钥?需要 Neovim 0.11.0 或更高版本,并为你选择的 AI 服务提供商配置 API 访问权限(Claude、OpenAI、Azure、Gemini、Cohere 或 GitHub Copilot)。
双增强模式等功能有什么需要注意的地方吗?双增强模式会混合两个服务提供商的回复,官方明确标注为实验性功能,表现可能不如预期。
这只能在 Linux 上用,还是也支持 macOS 和 Windows?只要 Neovim 和所需的二进制工具链(cargo,或用于预编译二进制的 curl/tar)能运行的地方都可以用,包括 Linux、macOS 和 Windows。
我怎样给 AI 提供项目相关的上下文?在项目根目录创建一个 avante.md 文件,描述 AI 的角色、任务、技术栈和编码规范;Avante 在所有交互中都会自动参考该文件。
智能体模式和旧版模式是什么?智能体模式通过调用工具自动生成并应用代码修改,旧版模式则依赖较早的基于规划的方式生成代码。
它会自动批准 AI 的操作(比如编辑文件)吗?默认情况下,autoApproveToolPermissions 会不经提示自动批准所有工具操作;你可以将其设为 false,或列出特定工具(如 'bash' 或 'strReplace'),改为需要确认。
我能混用多个服务提供商以获得更好的回答吗?可以,实验性的双增强模式会分别从两个服务提供商(例如 OpenAI 和 Claude)生成回复,并通过可配置的提示词将其合并为一个最终答案。
What are similar projects?maki, 99, trae-agent, jcode, opencode, Agent-S, oh-my-pi, claurst
Size
4.8 MB
Stars
18.2K
Age
2y
Commits · 90 Days