Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(completion): added avante-nvim plugin #1184

Merged
merged 18 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lua/astrocommunity/completion/avante-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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.


> [!IMPORTANT]
>
> `avante.nvim` is currently only compatible with Neovim 0.10.1 or later.

For more information, please refer to:

Repository: <https://github.com/yetone/avante.nvim>
96 changes: 96 additions & 0 deletions lua/astrocommunity/completion/avante-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
return {
"yetone/avante.nvim",
build = ":AvanteBuild",
vonhyou marked this conversation as resolved.
Show resolved Hide resolved
cmd = {
"AvanteAsk",
"AvanteBuild",
"AvanteConflictChooseAllTheirs",
"AvanteConflictChooseBase",
"AvanteConflictChooseBoth",
"AvanteConflictChooseCursor",
"AvanteConflictChooseNone",
"AvanteConflictChooseOurs",
"AvanteConflictChooseTheirs",
"AvanteConflictListQf",
"AvanteConflictNextConflict",
"AvanteConflictPrevConflict",
"AvanteEdit",
"AvanteRefresh",
"AvanteSwitchProvider",
},
vonhyou marked this conversation as resolved.
Show resolved Hide resolved
dependencies = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = assert(opts.mappings)
local prefix = "<Leader>a"

maps.n[prefix] = { desc = "Avante functionalities" }

maps.n[prefix .. "a"] = { function() require("avante.api").ask() end, desc = "Avante ask" }
maps.v[prefix .. "a"] = { function() require("avante.api").ask() end, desc = "Avante ask" }

maps.v[prefix .. "r"] = { function() require("avante.api").refresh() end, desc = "Avante refresh" }

maps.n[prefix .. "e"] = { function() require("avante.api").edit() end, desc = "Avante edit" }
maps.v[prefix .. "e"] = { function() require("avante.api").edit() end, desc = "Avante edit" }

-- the following key bindings do not have an official api implementation
maps.n.co = { ":AvanteConflictChooseOurs<CR>", desc = "Choose ours" }
maps.v.co = { ":AvanteConflictChooseOurs<CR>", desc = "Choose ours" }

maps.n.ct = { ":AvanteConflictChooseTheirs<CR>", desc = "Choose theirs" }
maps.v.ct = { ":AvanteConflictChooseTheirs<CR>", desc = "Choose theirs" }

maps.n.ca = { ":AvanteConflictChooseAllTheirs<CR>", desc = "Choose all theirs" }
maps.v.ca = { ":AvanteConflictChooseAllTheirs<CR>", desc = "Choose all theirs" }

maps.n.c0 = { ":AvanteConflictChooseNone<CR>", desc = "Choose none" }
maps.v.c0 = { ":AvanteConflictChooseNone<CR>", desc = "Choose none" }

maps.n.cb = { ":AvanteConflictChooseBoth<CR>", desc = "Choose both" }
maps.v.cb = { ":AvanteConflictChooseBoth<CR>", desc = "Choose both" }

maps.n.cc = { ":AvanteConflictChooseCursor<CR>", desc = "Choose cursor" }
maps.v.cc = { ":AvanteConflictChooseCursor<CR>", desc = "Choose cursor" }

maps.n["]x"] = { ":AvanteConflictPrevConflict<CR>", desc = "Move to previous conflict" }
maps.v["]x"] = { ":AvanteConflictPrevConflict<CR>", desc = "Move to previous conflict" }

maps.n["[x"] = { ":AvanteConflictNextConflict<CR>", desc = "Move to next conflict" }
maps.x["[x"] = { ":AvanteConflictNextConflict<CR>", desc = "Move to next conflict" }
end,
},
-- optional dependencies
"echasnovski/mini.icons", -- or "nvim-tree/nvim-web-devicons",
vonhyou marked this conversation as resolved.
Show resolved Hide resolved
"zbirenbaum/copilot.lua", -- for providers='copilot'
vonhyou marked this conversation as resolved.
Show resolved Hide resolved
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
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 setup it properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
vonhyou marked this conversation as resolved.
Show resolved Hide resolved
opts = {},
mehalter marked this conversation as resolved.
Show resolved Hide resolved
}
Loading