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 = {
{ '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 = {
{ '<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 = {
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' },
},

View File

@ -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' },
},

View File

@ -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