fix: avante.nvim

This commit is contained in:
Ryan Yin
2025-04-17 23:02:39 +08:00
parent 15628b667a
commit 75081d1d5a
3 changed files with 107 additions and 3 deletions

View File

@@ -52,6 +52,4 @@ return {
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
{ import = "astrocommunity.motion.nvim-spider" },
-- AI Assistant
{ import = "astrocommunity.completion.avante-nvim" },
}

View File

@@ -0,0 +1,101 @@
local prefix = "<Leader>A"
return {
"yetone/avante.nvim",
event = "User AstroFile", -- load on file open because Avante manages it's own bindings
cmd = {
"AvanteAsk",
"AvanteBuild",
"AvanteEdit",
"AvanteRefresh",
"AvanteSwitchProvider",
"AvanteShowRepoMap",
"AvanteModels",
"AvanteChat",
"AvanteToggle",
"AvanteClear",
"AvanteFocus",
"AvanteStop",
},
version = false, -- Never set this value to "*"! Never!
opts = {
-- add any opts here
provider = "deepseek",
vendors = {
deepseek = {
__inherited_from = "openai",
api_key_name = "DEEPSEEK_API_KEY",
endpoint = "https://api.deepseek.com",
model = "deepseek-chat",
},
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
{ "stevearc/dressing.nvim", optional = true },
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
{ "AstroNvim/astrocore", opts = function(_, opts) opts.mappings.n[prefix] = { desc = " Avante" } end },
--- The below dependencies are optional,
-- "echasnovski/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
"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,
},
mappings = {
ask = prefix .. "<CR>",
edit = prefix .. "e",
refresh = prefix .. "r",
focus = prefix .. "f",
select_model = prefix .. "?",
stop = prefix .. "S",
select_history = prefix .. "h",
toggle = {
default = prefix .. "t",
debug = prefix .. "d",
hint = prefix .. "h",
suggestion = prefix .. "s",
repomap = prefix .. "R",
},
diff = {
next = "]c",
prev = "[c",
},
files = {
add_current = prefix .. ".",
add_all_buffers = prefix .. "B",
},
},
},
specs = { -- configure optional plugins
{ "AstroNvim/astroui", opts = { icons = { Avante = "" } } },
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}