-
Notifications
You must be signed in to change notification settings - Fork 848
Home
Welcome to the avante.nvim wiki!
we will only fully support lazy.nvim. Every other package manager are best-efforts. If you want to use anything else, please submit PR on how to make those better, thanks.
A more secure way to set API key is through secret manager. You can do that by prefixing api_key_name like so:
{
"yetone/avante.nvim",
opts = {
provider = "claude",
claude = {
api_key_name = "cmd:bw get notes anthropic-api-key", -- the shell command must prefixed with `^cmd:(.*)`
-- api_key_name = {"bw","get","notes","anthropic-api-key"}, -- if it is a table of string, then default to command.
}
}
}In the input box, we have support a few slash commands. Try /help for more information.
Make sure that you have credits in your accounts 😃
set provider="copilot".
Avante.nvim provides two interaction modes:
-
agentic(default): Uses AI tools to automatically generate and apply code changes -
legacy: Uses the traditional planning method without automatic tool execution
To disable agentic mode and switch to legacy mode, update your configuration:
{
mode = "legacy", -- Switch from "agentic" to "legacy"
-- ... your other configuration options
}What's the difference?
- Agentic mode: AI can automatically execute tools like file operations, bash commands, web searches, etc. to complete complex tasks
- Legacy mode: AI provides suggestions and plans but requires manual approval for all actions
When should you use legacy mode?
- If you prefer more control over what actions the AI takes
- If you're concerned about security with automatic tool execution
- If you want to manually review each step before applying changes
- If you're working in a sensitive environment where automatic code changes aren't desired
You can also disable specific tools while keeping agentic mode enabled by configuring disabled_tools:
{
mode = "agentic",
disabled_tools = { "bash", "python" }, -- Disable specific tools
-- ... your other configuration options
}You can just add any accepted body fields to curl for given LLM provider:
opts = {
gemini = { -- see https://ai.google.dev/api/generate-content#request-body_1
generationConfig = {
stopSequences = {"test"},
}
}
}Since #346, we will expose certain functions that are considered "public" API through avante.api.
Additionally, we will safely add certain keymaps if users yet to set those (only applies for lazy.nvim users) for core functionality, including AvanteAsk, AvanteEdit, and AvanteRefresh
Important
This means Leaderaa won't be set to AvanteAsk if you already set this mapping.
The following <Plug> will also be available for compatibility sake:
<Plug>(AvanteAsk)<Plug>(AvanteEdit)<Plug>(AvanteRefresh)
Example settings for keys settings in lazy.nvim:
keys = function(_, keys)
---@type avante.Config
local opts =
require("lazy.core.plugin").values(require("lazy.core.config").spec.plugins["avante.nvim"], "opts", false)
local mappings = {
{
opts.mappings.ask,
function() require("avante.api").ask() end,
desc = "avante: ask",
mode = { "n", "v" },
},
{
opts.mappings.refresh,
function() require("avante.api").refresh() end,
desc = "avante: refresh",
mode = "v",
},
{
opts.mappings.edit,
function() require("avante.api").edit() end,
desc = "avante: edit",
mode = { "n", "v" },
},
}
mappings = vim.tbl_filter(function(m) return m[1] and #m[1] > 0 end, mappings)
return vim.list_extend(mappings, keys)
end,Important
If you have different keybinding, then update opts.mappings so that hint works accordingly.
If you are using lazy.nvim then use the snippet above.
{
opts = {
mappings = {
ask = "<leader>ua", -- ask
edit = "<leader>ue", -- edit
refresh = "<leader>ur", -- refresh
},
}
}Read https://github.com/yetone/avante.nvim/blob/main/lua/avante/api.lua
All fields for all .avanterules are available here
If you wish to load img-clip.nvim via keys, you can use the following:
keys = {
{
"<leader>ip",
function()
return vim.bo.filetype == "AvanteInput" and require("avante.clipboard").paste_image()
or require("img-clip").paste_image()
end,
desc = "clip: paste image",
},
}See https://github.com/yetone/avante.nvim/issues/315#issuecomment-2315957174
_G.convert_to_qf = function()
require('avante.diff').conflicts_to_qf_items(function(items)
if #items > 0 then
vim.fn.setqflist(items, "r")
vim.cmd('copen')
end
end)
endThen you can call this function in mappings or anything you want to do with it.
See https://github.com/yetone/avante.nvim/pull/527
Try set XDG_RUNTIME_DIR="/tmp/"