From 3b27256eb4a8124484b8bffaaf362f23a52f2d16 Mon Sep 17 00:00:00 2001 From: Fergus Molloy Date: Wed, 25 Jun 2025 16:08:13 +0100 Subject: [PATCH] update plugins for working with code companion --- lua/plugins/ai/codecompanion.lua | 29 ++++++++++++++++++++--------- lua/plugins/blink.lua | 21 +++------------------ lua/plugins/yeet.lua | 1 + 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/lua/plugins/ai/codecompanion.lua b/lua/plugins/ai/codecompanion.lua index 7b2c28f..9cec0ca 100644 --- a/lua/plugins/ai/codecompanion.lua +++ b/lua/plugins/ai/codecompanion.lua @@ -4,22 +4,36 @@ return { dependencies = { { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, { 'nvim-lua/plenary.nvim' }, + { 'ibhagwan/fzf-lua' }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { 'markdown', 'codecompanion' }, + }, + ft = { 'markdown', 'codecompanion' }, + }, }, keys = { { 'cc', 'CodeCompanionChat Toggle', desc = 'Open AI chat' }, - { 'cw', 'CodeCompanionAction', desc = 'Start new cody chat' }, + { 'ca', 'CodeCompanionAction', desc = 'Perform AI action' }, }, + cmd = { 'CodeCompanion', 'CodeCompanionAction', 'CodeCompanionChat', 'CodeCompanionCmd' }, opts = { adapters = { ollama = function() return require('codecompanion.adapters').extend('ollama', { schema = { model = { - default = 'deepseek-r1', + default = 'devstral', }, - -- num_ctx = { - -- default = 4096, - -- }, + }, + }) + end, + anthropic = function() + return require('codecompanion.adapters').extend('anthropic', { + env = { + api_key = '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', }, }) end, @@ -27,10 +41,7 @@ return { }, --Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua strategies = { - chat = { - adapter = 'ollama', - completion_provider = 'blink', -- blink|cmp|coc|default - }, + chat = { adapter = 'ollama' }, inline = { adapter = 'ollama' }, cmd = { adapter = 'ollama' }, }, diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index 1338663..726d22b 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -1,17 +1,10 @@ return { { 'saghen/blink.cmp', - version = 'v0.13.1', - event = 'LspAttach', + version = '1.*', + lazy = false, dependencies = { - 'Kaiser-Yang/blink-cmp-avante', - 'hrsh7th/nvim-cmp', 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-buffer', }, opts = { keymap = { @@ -31,22 +24,14 @@ return { }, appearance = { - use_nvim_cmp_as_default = true, nerd_font_variant = 'mono', }, sources = { - default = { 'avante', 'lsp', 'path', 'snippets', 'buffer' }, + default = { 'lsp', 'path', 'snippets', 'buffer' }, per_filetype = { codecompanion = { 'codecompanion' }, }, - providers = { - avante = { - module = 'blink-cmp-avante', - name = 'Avante', - opts = {}, - }, - }, }, snippets = { preset = 'luasnip' }, }, diff --git a/lua/plugins/yeet.lua b/lua/plugins/yeet.lua index 408026f..4c72018 100644 --- a/lua/plugins/yeet.lua +++ b/lua/plugins/yeet.lua @@ -6,6 +6,7 @@ return { clear_before_yeet = false, interrupt_before_yeet = true, yeet_and_run = true, + notify_on_success = true, custom_eval = function(cmd_string) if cmd_string:match '#test' then -- get current win's filetype