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, и предлагает ИИ-подсказки по коду, которые можно сразу применить к исходным файлам.
Это отдельное приложение или плагин, который я добавляю в редактор?Это плагин для Neovim, который устанавливается через менеджер плагинов вроде vim-plug, а не отдельное приложение.
Как его установить и настроить?Установите его через менеджер плагинов (например, vim-plug), затем укажите провайдера, например claude, openai, azure или gemini, в конфигурации на Lua; если собираете из исходников, нужен cargo, иначе curl и tar загрузят готовый бинарный файл с GitHub.
Какая версия Neovim и какие API-ключи мне нужны?Нужен Neovim версии 0.11.0 или новее и доступ к API того ИИ-провайдера, который вы выберете (Claude, OpenAI, Azure, Gemini, Cohere или GitHub Copilot).
Есть подводные камни с функциями вроде режима dual-boost?Режим dual-boost, который объединяет ответы от двух провайдеров, прямо помечен как экспериментальный и может работать не так, как ожидается.
Работает ли это только на Linux или также на macOS и Windows?Работает везде, где запускаются Neovim и нужный набор бинарных инструментов (cargo или curl/tar для готовых бинарников), включая Linux, macOS и Windows.
Как передать ИИ контекст, специфичный для проекта?Создайте файл avante.md в корне проекта с описанием роли и задачи ИИ, стека технологий и стандартов кодирования; на него автоматически ссылаются во всех взаимодействиях с Avante.
Что такое агентный и legacy-режимы?Агентный режим использует инструменты, чтобы автоматически генерировать и применять изменения в коде, а legacy-режим опирается на более старый метод генерации кода на основе планирования.
Одобряет ли он действия ИИ автоматически, например редактирование файлов?По умолчанию autoApproveToolPermissions автоматически одобряет все действия инструментов без запроса; можно установить false или перечислить конкретные инструменты (например, 'bash' или 'strReplace'), чтобы требовать подтверждение.
Можно ли смешивать провайдеров для более качественных ответов?Да, экспериментальный режим dual-boost получает ответы от двух провайдеров (например, OpenAI и Claude) и объединяет их в один итоговый ответ с помощью настраиваемого промпта.
What are similar projects?maki, 99, trae-agent, jcode, opencode, Agent-S, oh-my-pi, claurst
Size
4.9 MB
Stars
18.2K
Age
2y
Commits · 90 Days