From c8195e748ec407c2c62c199ee2c89c732ea2b217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Sat, 14 Sep 2024 18:07:05 -0300 Subject: [PATCH 1/5] feat(ai): add avante.nvim for a better AI experience --- lua/lazyvim/plugins/extras/ai/avante.lua | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/ai/avante.lua diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua new file mode 100644 index 00000000..3bd1c535 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -0,0 +1,68 @@ +return { + { + "yetone/avante.nvim", + event = "VeryLazy", + dependencies = { + "stevearc/dressing.nvim", + }, + opts = function(_, opts) + -- Default configuration + opts.hints = { enabled = false } + + -- File selector configuration + --- @alias FileSelectorProvider "native" | "fzf" | "mini.pick" | "snacks" | "telescope" | string + opts.file_selector = { + provider = "fzf", + provider_opts = {}, + } + + -- Blink.cmp integration + -- LSP score_offset is typically 60 + opts.providers = { + avante_commands = { + name = "avante_commands", + module = "blink.compat.source", + score_offset = 90, -- show at a higher priority than lsp + opts = {}, + }, + avante_files = { + name = "avante_files", + module = "blink.compat.source", + score_offset = 100, -- show at a higher priority than lsp + opts = {}, + }, + avante_mentions = { + name = "avante_mentions", + module = "blink.compat.source", + score_offset = 1000, -- show at a higher priority than lsp + opts = {}, + }, + } + opts.compat = { + "avante_commands", + "avante_mentions", + "avante_files", + } + end, + build = LazyVim.is_win() and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make", + }, + { + "MeanderingProgrammer/render-markdown.nvim", + optional = true, + ft = function(_, ft) + vim.list_extend(ft, { "Avante" }) + end, + opts = function(_, opts) + opts.file_types = vim.list_extend(opts.file_types or {}, { "Avante" }) + end, + }, + { + "folke/which-key.nvim", + optional = true, + opts = { + spec = { + { "a", group = "ai" }, + }, + }, + }, +} From 91f5850c3cdd1566a0fd4c1ef7de569071b28d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Tue, 28 Jan 2025 09:40:48 -0300 Subject: [PATCH 2/5] Update lua/lazyvim/plugins/extras/ai/avante.lua Co-authored-by: PatMulligan <43773168+PatMulligan@users.noreply.github.com> --- lua/lazyvim/plugins/extras/ai/avante.lua | 50 ++++++++---------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index 3bd1c535..eb249859 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -5,45 +5,27 @@ return { dependencies = { "stevearc/dressing.nvim", }, - opts = function(_, opts) + opts = { -- Default configuration - opts.hints = { enabled = false } + hints = { enabled = false }, + + ---@alias AvanteProvider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string + provider = "claude", -- Recommend using Claude + auto_suggestions_provider = "claude", -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot + claude = { + endpoint = "https://api.anthropic.com", + model = "claude-3-5-sonnet-20241022", + temperature = 0, + max_tokens = 4096, + }, -- File selector configuration --- @alias FileSelectorProvider "native" | "fzf" | "mini.pick" | "snacks" | "telescope" | string - opts.file_selector = { - provider = "fzf", + file_selector = { + provider = "fzf", -- Avoid native provider issues provider_opts = {}, - } - - -- Blink.cmp integration - -- LSP score_offset is typically 60 - opts.providers = { - avante_commands = { - name = "avante_commands", - module = "blink.compat.source", - score_offset = 90, -- show at a higher priority than lsp - opts = {}, - }, - avante_files = { - name = "avante_files", - module = "blink.compat.source", - score_offset = 100, -- show at a higher priority than lsp - opts = {}, - }, - avante_mentions = { - name = "avante_mentions", - module = "blink.compat.source", - score_offset = 1000, -- show at a higher priority than lsp - opts = {}, - }, - } - opts.compat = { - "avante_commands", - "avante_mentions", - "avante_files", - } - end, + }, + }, build = LazyVim.is_win() and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make", }, { From 326fddd92702ccc618a26be6b3b74c9d22b3219c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Tue, 28 Jan 2025 09:40:59 -0300 Subject: [PATCH 3/5] Update lua/lazyvim/plugins/extras/ai/avante.lua Co-authored-by: PatMulligan <43773168+PatMulligan@users.noreply.github.com> --- lua/lazyvim/plugins/extras/ai/avante.lua | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index eb249859..01763c98 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -28,6 +28,42 @@ return { }, build = LazyVim.is_win() and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make", }, + { + "saghen/blink.cmp", + lazy = true, + opts = { + sources = { + default = { "avante_commands", "avante_mentions", "avante_files" }, + compat = { + "avante_commands", + "avante_mentions", + "avante_files", + }, + -- LSP score_offset is typically 60 + providers = { + avante_commands = { + name = "avante_commands", + module = "blink.compat.source", + score_offset = 90, + opts = {}, + }, + avante_files = { + name = "avante_files", + module = "blink.compat.source", + score_offset = 100, + opts = {}, + }, + avante_mentions = { + name = "avante_mentions", + module = "blink.compat.source", + score_offset = 1000, + opts = {}, + }, + }, + }, + }, + }, + { "MeanderingProgrammer/render-markdown.nvim", optional = true, From 2653f52176cc521a995990b96541e5718ad5522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Tue, 28 Jan 2025 10:29:00 -0300 Subject: [PATCH 4/5] chore: add dependencies --- lua/lazyvim/plugins/extras/ai/avante.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index 01763c98..b5888b1d 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -4,6 +4,7 @@ return { event = "VeryLazy", dependencies = { "stevearc/dressing.nvim", + "ibhagwan/fzf-lua", }, opts = { -- Default configuration @@ -28,9 +29,10 @@ return { }, build = LazyVim.is_win() and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make", }, - { + { "saghen/blink.cmp", lazy = true, + dependencies = { "saghen/blink.compat" }, opts = { sources = { default = { "avante_commands", "avante_mentions", "avante_files" }, @@ -63,7 +65,6 @@ return { }, }, }, - { "MeanderingProgrammer/render-markdown.nvim", optional = true, From 67546eb094df5f3f75a4200e63f2741068944ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Mon, 23 Jun 2025 11:48:18 -0300 Subject: [PATCH 5/5] update avante --- lua/lazyvim/plugins/extras/ai/avante.lua | 104 +++++++---------------- 1 file changed, 30 insertions(+), 74 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index b5888b1d..b93289b2 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -2,85 +2,41 @@ return { { "yetone/avante.nvim", event = "VeryLazy", + version = false, + opts = { + provider = "claude", + }, dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "hrsh7th/nvim-cmp", "stevearc/dressing.nvim", - "ibhagwan/fzf-lua", - }, - opts = { - -- Default configuration - hints = { enabled = false }, - - ---@alias AvanteProvider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string - provider = "claude", -- Recommend using Claude - auto_suggestions_provider = "claude", -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot - claude = { - endpoint = "https://api.anthropic.com", - model = "claude-3-5-sonnet-20241022", - temperature = 0, - max_tokens = 4096, - }, - - -- File selector configuration - --- @alias FileSelectorProvider "native" | "fzf" | "mini.pick" | "snacks" | "telescope" | string - file_selector = { - provider = "fzf", -- Avoid native provider issues - provider_opts = {}, - }, - }, - build = LazyVim.is_win() and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make", - }, - { - "saghen/blink.cmp", - lazy = true, - dependencies = { "saghen/blink.compat" }, - opts = { - sources = { - default = { "avante_commands", "avante_mentions", "avante_files" }, - compat = { - "avante_commands", - "avante_mentions", - "avante_files", - }, - -- LSP score_offset is typically 60 - providers = { - avante_commands = { - name = "avante_commands", - module = "blink.compat.source", - score_offset = 90, - opts = {}, - }, - avante_files = { - name = "avante_files", - module = "blink.compat.source", - score_offset = 100, - opts = {}, - }, - avante_mentions = { - name = "avante_mentions", - module = "blink.compat.source", - score_offset = 1000, - opts = {}, + "folke/snacks.nvim", + "echasnovski/mini.icons", + "zbirenbaum/copilot.lua", + { + "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, }, }, }, - }, - }, - { - "MeanderingProgrammer/render-markdown.nvim", - optional = true, - ft = function(_, ft) - vim.list_extend(ft, { "Avante" }) - end, - opts = function(_, opts) - opts.file_types = vim.list_extend(opts.file_types or {}, { "Avante" }) - end, - }, - { - "folke/which-key.nvim", - optional = true, - opts = { - spec = { - { "a", group = "ai" }, + { + "MeanderingProgrammer/render-markdown.nvim", + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, }, }, },