update plugins for working with code companion

This commit is contained in:
2025-06-25 16:08:13 +01:00
parent 76f1f2fcc1
commit 3b27256eb4
3 changed files with 24 additions and 27 deletions

View File

@ -4,22 +4,36 @@ return {
dependencies = { dependencies = {
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
{ 'nvim-lua/plenary.nvim' }, { '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 = { keys = {
{ '<leader>cc', '<cmd>CodeCompanionChat Toggle<cr>', desc = 'Open AI chat' }, { '<leader>cc', '<cmd>CodeCompanionChat Toggle<cr>', desc = 'Open AI chat' },
{ '<leader>cw', '<cmd>CodeCompanionAction<cr>', desc = 'Start new cody chat' }, { '<leader>ca', '<cmd>CodeCompanionAction<cr>', desc = 'Perform AI action' },
}, },
cmd = { 'CodeCompanion', 'CodeCompanionAction', 'CodeCompanionChat', 'CodeCompanionCmd' },
opts = { opts = {
adapters = { adapters = {
ollama = function() ollama = function()
return require('codecompanion.adapters').extend('ollama', { return require('codecompanion.adapters').extend('ollama', {
schema = { schema = {
model = { 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, end,
@ -27,10 +41,7 @@ return {
}, },
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua --Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
strategies = { strategies = {
chat = { chat = { adapter = 'ollama' },
adapter = 'ollama',
completion_provider = 'blink', -- blink|cmp|coc|default
},
inline = { adapter = 'ollama' }, inline = { adapter = 'ollama' },
cmd = { adapter = 'ollama' }, cmd = { adapter = 'ollama' },
}, },

View File

@ -1,17 +1,10 @@
return { return {
{ {
'saghen/blink.cmp', 'saghen/blink.cmp',
version = 'v0.13.1', version = '1.*',
event = 'LspAttach', lazy = false,
dependencies = { dependencies = {
'Kaiser-Yang/blink-cmp-avante',
'hrsh7th/nvim-cmp',
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
'hrsh7th/cmp-buffer',
}, },
opts = { opts = {
keymap = { keymap = {
@ -31,22 +24,14 @@ return {
}, },
appearance = { appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = 'mono', nerd_font_variant = 'mono',
}, },
sources = { sources = {
default = { 'avante', 'lsp', 'path', 'snippets', 'buffer' }, default = { 'lsp', 'path', 'snippets', 'buffer' },
per_filetype = { per_filetype = {
codecompanion = { 'codecompanion' }, codecompanion = { 'codecompanion' },
}, },
providers = {
avante = {
module = 'blink-cmp-avante',
name = 'Avante',
opts = {},
},
},
}, },
snippets = { preset = 'luasnip' }, snippets = { preset = 'luasnip' },
}, },

View File

@ -6,6 +6,7 @@ return {
clear_before_yeet = false, clear_before_yeet = false,
interrupt_before_yeet = true, interrupt_before_yeet = true,
yeet_and_run = true, yeet_and_run = true,
notify_on_success = true,
custom_eval = function(cmd_string) custom_eval = function(cmd_string)
if cmd_string:match '#test' then if cmd_string:match '#test' then
-- get current win's filetype -- get current win's filetype