Skip to content

Commit 331bf6f

Browse files
vonhyouUzaaftmehalter
authored
feat(completion): added avante-nvim plugin (#1184)
* add avante plug and readme * test and add render-markdown.nvim as recommended * fix typo * change to mini.icons * switch to fenced link * remove redundant config * add avante cmds * add keymaps opts that have api impl and documented bindings * add keymaps opts that have cmds * Update lua/astrocommunity/completion/avante-nvim/init.lua To ensure the plugin is loading as expected Co-authored-by: Uzair Aftab <[email protected]> * Update lua/astrocommunity/completion/avante-nvim/init.lua Removed because `lazy = false` is added Co-authored-by: Uzair Aftab <[email protected]> * Update lua/astrocommunity/completion/avante-nvim/README.md Co-authored-by: Uzair Aftab <[email protected]> * adjust plugin loading and its dependency * re-add cmd define * remove default icon package config Co-authored-by: Micah Halter <[email protected]> * remove optional dependency: copilot provider Co-authored-by: Micah Halter <[email protected]> * remove all optional dependencies * add configuration of optional plugins --------- Co-authored-by: Uzair Aftab <[email protected]> Co-authored-by: Micah Halter <[email protected]>
1 parent 19a23e9 commit 331bf6f

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Avante.nvim is a Neovim plugin that emulates the Cursor AI IDE's functionality. It provides AI-driven code suggestions and allows users to apply these recommendations directly to their source files with minimal effort.
2+
3+
4+
> [!IMPORTANT]
5+
>
6+
> `avante.nvim` is currently only compatible with Neovim 0.10.1 or later.
7+
8+
For more information, please refer to:
9+
10+
Repository: <https://github.com/yetone/avante.nvim>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
return {
2+
"yetone/avante.nvim",
3+
build = ":AvanteBuild",
4+
cmd = {
5+
"AvanteAsk",
6+
"AvanteBuild",
7+
"AvanteConflictChooseAllTheirs",
8+
"AvanteConflictChooseBase",
9+
"AvanteConflictChooseBoth",
10+
"AvanteConflictChooseCursor",
11+
"AvanteConflictChooseNone",
12+
"AvanteConflictChooseOurs",
13+
"AvanteConflictChooseTheirs",
14+
"AvanteConflictListQf",
15+
"AvanteConflictNextConflict",
16+
"AvanteConflictPrevConflict",
17+
"AvanteEdit",
18+
"AvanteRefresh",
19+
"AvanteSwitchProvider",
20+
},
21+
dependencies = {
22+
"stevearc/dressing.nvim",
23+
"nvim-lua/plenary.nvim",
24+
"MunifTanjim/nui.nvim",
25+
{
26+
"AstroNvim/astrocore",
27+
opts = function(_, opts)
28+
local maps = assert(opts.mappings)
29+
local prefix = "<Leader>a"
30+
31+
maps.n[prefix] = { desc = "Avante functionalities" }
32+
33+
maps.n[prefix .. "a"] = { function() require("avante.api").ask() end, desc = "Avante ask" }
34+
maps.v[prefix .. "a"] = { function() require("avante.api").ask() end, desc = "Avante ask" }
35+
36+
maps.v[prefix .. "r"] = { function() require("avante.api").refresh() end, desc = "Avante refresh" }
37+
38+
maps.n[prefix .. "e"] = { function() require("avante.api").edit() end, desc = "Avante edit" }
39+
maps.v[prefix .. "e"] = { function() require("avante.api").edit() end, desc = "Avante edit" }
40+
41+
-- the following key bindings do not have an official api implementation
42+
maps.n.co = { ":AvanteConflictChooseOurs<CR>", desc = "Choose ours" }
43+
maps.v.co = { ":AvanteConflictChooseOurs<CR>", desc = "Choose ours" }
44+
45+
maps.n.ct = { ":AvanteConflictChooseTheirs<CR>", desc = "Choose theirs" }
46+
maps.v.ct = { ":AvanteConflictChooseTheirs<CR>", desc = "Choose theirs" }
47+
48+
maps.n.ca = { ":AvanteConflictChooseAllTheirs<CR>", desc = "Choose all theirs" }
49+
maps.v.ca = { ":AvanteConflictChooseAllTheirs<CR>", desc = "Choose all theirs" }
50+
51+
maps.n.c0 = { ":AvanteConflictChooseNone<CR>", desc = "Choose none" }
52+
maps.v.c0 = { ":AvanteConflictChooseNone<CR>", desc = "Choose none" }
53+
54+
maps.n.cb = { ":AvanteConflictChooseBoth<CR>", desc = "Choose both" }
55+
maps.v.cb = { ":AvanteConflictChooseBoth<CR>", desc = "Choose both" }
56+
57+
maps.n.cc = { ":AvanteConflictChooseCursor<CR>", desc = "Choose cursor" }
58+
maps.v.cc = { ":AvanteConflictChooseCursor<CR>", desc = "Choose cursor" }
59+
60+
maps.n["]x"] = { ":AvanteConflictPrevConflict<CR>", desc = "Move to previous conflict" }
61+
maps.v["]x"] = { ":AvanteConflictPrevConflict<CR>", desc = "Move to previous conflict" }
62+
63+
maps.n["[x"] = { ":AvanteConflictNextConflict<CR>", desc = "Move to next conflict" }
64+
maps.x["[x"] = { ":AvanteConflictNextConflict<CR>", desc = "Move to next conflict" }
65+
end,
66+
},
67+
},
68+
opts = {},
69+
specs = { -- configure optional plugins
70+
{ -- if copilot.lua is available, default to copilot provider
71+
"zbirenbaum/copilot.lua",
72+
optional = true,
73+
specs = {
74+
{
75+
"yetone/avante.nvim",
76+
opts = {
77+
provider = "copilot",
78+
},
79+
},
80+
},
81+
},
82+
{
83+
-- make sure `Avante` is added as a filetype
84+
"MeanderingProgrammer/render-markdown.nvim",
85+
optional = true,
86+
opts = function(_, opts)
87+
if not opts.file_types then opts.filetypes = { "markdown" } end
88+
opts.file_types = require("astrocore").list_insert_unique(opts.file_types, { "Avante" })
89+
end,
90+
},
91+
{
92+
-- make sure `Avante` is added as a filetype
93+
"OXY2DEV/markview.nvim",
94+
optional = true,
95+
opts = function(_, opts)
96+
if not opts.filetypes then opts.filetypes = { "markdown", "quarto", "rmd" } end
97+
opts.filetypes = require("astrocore").list_insert_unique(opts.filetypes, { "Avante" })
98+
end,
99+
},
100+
},
101+
}

0 commit comments

Comments
 (0)