avante.nvim is a Neovim plugin designed to emulate the behavior of the Cursor AI IDE, providing 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!
avante-2.mp4
avante-3.mp4
- AI-Powered Code Assistance: Interact with AI to ask questions about your current code file and receive intelligent suggestions for improvement or modification.
- One-Click Application: Quickly apply the AI's suggested changes to your source code with a single command, streamlining the editing process and saving time.
Install avante.nvim
using lazy.nvim:
{
"yetone/avante.nvim",
event = "VeryLazy",
build = "make",
opts = {
-- add any opts here
},
dependencies = {
"nvim-tree/nvim-web-devicons",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below is optional, make sure to setup it properly if you have lazy=true
{
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}
For Windows users, change the build command to the following:
{
"yetone/avante.nvim",
event = "VeryLazy",
build = "powershell -ExecutionPolicy Bypass -File Build-LuaTiktoken.ps1",
-- rest of the config
}
Important
avante.nvim
is currently only compatible with Neovim 0.10.0 or later. Please ensure that your Neovim version meets these requirements before proceeding.
Important
If your neovim doesn't use LuaJIT, then change build
to make lua51
. By default running make will install luajit.
For ARM-based setup, make sure to also install cargo as we will have to build the tiktoken_core from source.
Note
Recommended Neovim options:
-- views can only be fully collapsed with the global statusline
vim.opt.laststatus = 3
-- Default splitting will cause your main splits to jump when opening an edgebar.
-- To prevent this, set `splitkeep` to either `screen` or `topline`.
vim.opt.splitkeep = "screen"
Note
render-markdown.nvim
is an optional dependency that is used to render the markdown content of the chat history. Make sure to also include Avante
as a filetype
to its setup:
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
}
Default setup configuration:
See config.lua#L9 for the full config
{
---@alias Provider "openai" | "claude" | "azure" | "deepseek" | "groq" | "copilot" | [string]
provider = "claude",
claude = {
endpoint = "https://api.anthropic.com",
model = "claude-3-5-sonnet-20240620",
temperature = 0,
max_tokens = 4096,
},
mappings = {
ask = "<leader>aa",
edit = "<leader>ae",
refresh = "<leader>ar",
--- @class AvanteConflictMappings
diff = {
ours = "co",
theirs = "ct",
none = "c0",
both = "cb",
next = "]x",
prev = "[x",
},
jump = {
next = "]]",
prev = "[[",
},
},
hints = { enabled = true },
windows = {
wrap = true, -- similar to vim.o.wrap
width = 30, -- default % based on available width
sidebar_header = {
align = "center", -- left, center, right for title
rounded = true,
},
},
highlights = {
---@type AvanteConflictHighlights
diff = {
current = "DiffText",
incoming = "DiffAdd",
},
},
--- @class AvanteConflictUserConfig
diff = {
debug = false,
autojump = true,
---@type string | fun(): any
list_opener = "copen",
},
}
Given its early stage, avante.nvim
currently supports the following basic functionalities:
Important
For most consistency between neovim session, it is recommended to set the environment variables in your shell file.
By default, Avante
will prompt you at startup to input the API key for the provider you have selected.
For Claude:
export ANTHROPIC_API_KEY=your-api-key
For OpenAI:
export OPENAI_API_KEY=your-api-key
For Azure OpenAI:
export AZURE_OPENAI_API_KEY=your-api-key
For DeepSeek
export DEEPSEEK_API_KEY=you-api-key
For Groq
export GROQ_API_KEY=you-api-key
- Open a code file in Neovim.
- Use the
:AvanteAsk
command to query the AI about the code. - Review the AI's suggestions.
- Apply the recommended changes directly to your code with a simple command or key binding.
Note: The plugin is still under active development, and both its functionality and interface are subject to significant changes. Expect some rough edges and instability as the project evolves.
The following key bindings are available for use with avante.nvim
:
- Leaderaa β show sidebar
- Leaderar β show sidebar
- co β choose ours
- ct β choose theirs
- cb β choose both
- c0 β choose none
- ]x β move to previous conflict
- [x β move to next conflict
- Enhanced AI Interactions: Improve the depth of AI analysis and recommendations for more complex coding scenarios.
- Stability Improvements: Refactor and optimize the codebase to enhance the stability and reliability of the plugin.
- Expanded Features: Introduce additional customization options and new features to support a wider range of coding tasks.
- Chat with current file
- Apply diff patch
- Chat with the selected block
- Edit the selected block
- Smart Tab (Cursor Flow)
- Chat with project
- Chat with selected files
Contributions to avante.nvim are welcome! If you're interested in helping out, please feel free to submit pull requests or open issues. Before contributing, ensure that your code has been thoroughly tested.
See wiki for more recipes and tricks.
avante.nvim is licensed under the Apache License. For more details, please refer to the LICENSE file.