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/9] 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/9] 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/9] 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/9] 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/9] 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" }, }, }, }, From 93946eea216a5687ce6edc149bd3f71a8398c5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Sun, 10 Aug 2025 18:34:04 -0300 Subject: [PATCH 6/9] default to copilot and use optional in dependencies --- lua/lazyvim/plugins/extras/ai/avante.lua | 30 +++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index b93289b2..bfbcfa79 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -1,23 +1,33 @@ return { { "yetone/avante.nvim", + build = vim.fn.has("win32") ~= 0 and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" + or "make", event = "VeryLazy", version = false, opts = { - provider = "claude", + provider = "copilot", + hints = { + enabled = false, + }, }, dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - "hrsh7th/nvim-cmp", - "stevearc/dressing.nvim", - "folke/snacks.nvim", - "echasnovski/mini.icons", - "zbirenbaum/copilot.lua", + { "nvim-lua/plenary.nvim", optional = true }, + { "MunifTanjim/nui.nvim", optional = true }, + --- The below dependencies are optional, + { "echasnovski/mini.pick", optional = true }, -- for file_selector provider mini.pick + { "nvim-telescope/telescope.nvim", optional = true }, -- for file_selector provider telescope + { "hrsh7th/nvim-cmp", optional = true }, -- autocompletion for avante commands and mentions + { "ibhagwan/fzf-lua", optional = true }, -- for file_selector provider fzf + { "stevearc/dressing.nvim", optional = true }, -- for input provider dressing + { "folke/snacks.nvim", optional = true }, -- for input provider snacks + { "nvim-tree/nvim-web-devicons", optional = true }, -- or echasnovski/mini.icons + { "zbirenbaum/copilot.lua", optional = true }, -- for providers='copilot' { + -- support for image pasting "HakonHarnes/img-clip.nvim", event = "VeryLazy", + optional = true, opts = { -- recommended settings default = { @@ -32,7 +42,9 @@ return { }, }, { + -- Make sure to set this up properly if you have lazy=true "MeanderingProgrammer/render-markdown.nvim", + optional = true, opts = { file_types = { "markdown", "Avante" }, }, From 8af21160f87dec5d8ac9b8658d4667bc1c1cb8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Sun, 10 Aug 2025 18:45:15 -0300 Subject: [PATCH 7/9] add blink-cmp-avante to help with avante commands --- lua/lazyvim/plugins/extras/ai/avante.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index bfbcfa79..8fb498c1 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -50,6 +50,22 @@ return { }, ft = { "markdown", "Avante" }, }, + { + "Kaiser-Yang/blink-cmp-avante", + lazy = true, + specs = { + { + "saghen/blink.cmp", + optional = true, + opts = { + sources = { + default = { "avante" }, + providers = { avante = { module = "blink-cmp-avante", name = "Avante" } }, + }, + }, + }, + }, + }, }, }, } From b68352f1c809967ad7639eb65496cfbda6da93b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Sun, 10 Aug 2025 18:46:44 -0300 Subject: [PATCH 8/9] these are not optional deps --- lua/lazyvim/plugins/extras/ai/avante.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index 8fb498c1..a55826fa 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -12,9 +12,9 @@ return { }, }, dependencies = { - { "nvim-lua/plenary.nvim", optional = true }, - { "MunifTanjim/nui.nvim", optional = true }, - --- The below dependencies are optional, + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "zbirenbaum/copilot.lua", { "echasnovski/mini.pick", optional = true }, -- for file_selector provider mini.pick { "nvim-telescope/telescope.nvim", optional = true }, -- for file_selector provider telescope { "hrsh7th/nvim-cmp", optional = true }, -- autocompletion for avante commands and mentions @@ -22,7 +22,6 @@ return { { "stevearc/dressing.nvim", optional = true }, -- for input provider dressing { "folke/snacks.nvim", optional = true }, -- for input provider snacks { "nvim-tree/nvim-web-devicons", optional = true }, -- or echasnovski/mini.icons - { "zbirenbaum/copilot.lua", optional = true }, -- for providers='copilot' { -- support for image pasting "HakonHarnes/img-clip.nvim", From b16c86b788a564fc079ee65c6a117e42dd9621f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Wed, 13 Aug 2025 10:00:15 -0300 Subject: [PATCH 9/9] Update lua/lazyvim/plugins/extras/ai/avante.lua Co-authored-by: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> --- lua/lazyvim/plugins/extras/ai/avante.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/avante.lua b/lua/lazyvim/plugins/extras/ai/avante.lua index a55826fa..1bcd3480 100644 --- a/lua/lazyvim/plugins/extras/ai/avante.lua +++ b/lua/lazyvim/plugins/extras/ai/avante.lua @@ -50,18 +50,15 @@ return { ft = { "markdown", "Avante" }, }, { - "Kaiser-Yang/blink-cmp-avante", - lazy = true, - specs = { - { - "saghen/blink.cmp", - optional = true, - opts = { - sources = { - default = { "avante" }, - providers = { avante = { module = "blink-cmp-avante", name = "Avante" } }, - }, - }, + "saghen/blink.cmp", + optional = true, + dependencies = { + "Kaiser-Yang/blink-cmp-avante", + }, + opts = { + sources = { + default = { "avante" }, + providers = { avante = { module = "blink-cmp-avante", name = "Avante" } }, }, }, },