feat(nvim): move from avante to codecompanion (#222)

Change the AI tool from [avante][0] to [codecompanion][1] to check if it's a better alternative.

Also, install additional tools such as:

* [mcphub][2]
* [vectorcode][3]

These should improve the experience with AI tooling.

Reviewed-on: #222

[0]: https://github.com/yetone/avante.nvim
[1]: https://codecompanion.olimorris.dev/
[2]: https://github.com/ravitemer/mcphub.nvim
[3]: https://github.com/Davidyz/VectorCode
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
João Paulo Dubas 2025-05-07 11:39:51 +00:00 committed by João Paulo Dubas
parent 44757c8919
commit 44eca8b20d
5 changed files with 168 additions and 120 deletions

21
config/mcphub/config.json Normal file
View File

@ -0,0 +1,21 @@
{
"mcpServers": {
"context7": {
"command": "pnpm",
"args": [
"dlx",
"@upstash/context7-mcp@latest"
]
},
"git": {
"command": "uvx",
"args": [
"mcp-server-git"
]
},
"vectorcode": {
"command": "vectorcode-mcp-server",
"args": []
}
}
}

View File

@ -29,7 +29,7 @@
"go:github.com/bloznelis/typioca" = "3.1.0"
"npm:@anthropic-ai/claude-code" = "0.2.78"
"pipx:aider-chat" = { version = "0.82.2", uvx_args = "--python 3.12.7 --with google-generativeai" }
"pipx:vectorcode" = { version = "0.5.6", uvx_args = "--python 3.13.2" }
"pipx:vectorcode" = { version = "0.5.6", uvx_args = "--python 3.13.2", extras = "mcp" }
"ubi:Samyak2/toipe" = "0.5.0"
"ubi:hlsxx/tukai" = "0.2.2"
"ubi:jdx/usage" = "2.0.7"

View File

@ -145,137 +145,158 @@ return {
end,
},
{
'yetone/avante.nvim',
event = 'VeryLazy',
lazy = false,
version = false,
'ravitemer/mcphub.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
},
cmd = 'MCPHub',
build = 'bundled_build.lua',
opts = {
provider = 'gemini_pro',
auto_suggestion_provider = 'gemini_flash',
claude = {
model = 'claude-3-7-sonnet-20250219',
temperature = 0,
max_tokens = 20480,
},
vendors = {
gemini_pro = {
__inherited_from = 'gemini',
model = 'gemini-2.5-pro-exp-03-25',
temperature = 0.25,
max_tokens = 204800,
},
gemini_flash = {
__inherited_from = 'gemini',
model = 'gemini-2.0-flash',
temperature = 0.25,
max_tokens = 20480,
},
},
behaviour = {
auto_suggestions = false,
auto_set_highlight_group = true,
aute_set_keymaps = true,
auto_apply_diff_after_generation = true,
support_paste_from_clipboard = false,
minimize_diff = true,
},
mappings = {
diff = {
ours = 'co',
theirs = 'ct',
all_theirs = 'ca',
both = 'cb',
cursor = 'cc',
next = ']x',
prev = '[x',
},
suggestion = {
accept = '<M-l>',
next = '<M-]>',
prev = '<M-[>',
dismiss = '<C-]>',
},
jump = {
next = ']]',
prev = '[[',
},
submit = {
normal = '<CR>',
insert = '<C-s>',
},
sidebar = {
apply_all = 'A',
apply_cursor = 'a',
switch_windows = '<Tab>',
reverse_switch_windows = '<S-Tab>',
},
},
hints = { enabled = true },
windows = {
position = 'right',
wrap = true,
width = 30,
sidebar_header = {
enabled = true,
align = 'center',
rounded = true,
},
input = {
prefix = '> ',
height = 8,
},
edit = {
port = 37373,
config = vim.fn.expand '~/.config/mcphub/servers.json',
native_servers = {},
auto_approve = true,
auto_toggle_mcp_servers = true,
extensions = {},
ui = {
window = {
width = 0.8,
height = 0.8,
relative = 'editor',
zindex = 50,
border = 'rounded',
start_insert = true,
},
ask = {
floating = false,
start_insert = true,
border = 'rounded',
focus_on_apply = 'ours',
},
wo = {},
},
highlights = {
diff = {
current = 'DiffText',
incoming = 'DiffAdd',
},
},
diff = {
autojump = true,
list_opener = 'copen',
override_timeoutlen = 500,
use_bundled_binary = true,
log = {
level = vim.log.levels.WARN,
prefix = '[MCPHub]',
},
},
build = 'make',
},
{
'Davidyz/VectorCode',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'stevearc/dressing.nvim',
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
'hrsh7th/nvim-cmp',
'nvim-telescope/telescope.nvim',
'nvim-tree/nvim-web-devicons',
{
'HakonHarnes/img-clip.nvim',
event = 'VeryLazy',
opts = {
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
use_absolute_path = true,
},
},
version = vim.fn.system { 'mise', 'current', 'pipx:vectorcode' },
opts = function()
return {
async_opts = {
debounce = 10,
events = { 'BufWritePost', 'InsertEnter', 'BufReadPost' },
exclude_this = true,
n_query = 1,
notify = false,
query_cb = require('vectorcode.utils').make_surrounding_lines_cb(-1),
run_on_register = false,
},
},
async_backend = 'default',
exclude_this = true,
n_query = 1,
notify = true,
timeout_ms = 5000,
on_setup = {
update = false,
lsp = false,
},
sync_log_env_var = false,
}
end,
},
{
'olimorris/codecompanion.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
{
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { 'markdown', 'Avante' },
file_types = { 'markdown', 'codecompanion' },
},
ft = { 'markdown', 'Avante' },
ft = { 'markdown', 'codecompanion' },
},
},
opts = function()
return {
display = {
action_palette = {
width = 95,
height = 15,
prompt = 'Prompt',
provide = 'telescope',
},
},
adapters = {
gemini_pro = function()
return require('codecompanion.adapters').extend('gemini', {
name = 'gemini_pro',
schema = {
model = {
default = 'gemini-2.5-pro-exp-03-25',
},
},
})
end,
gemini_flash = function()
return require('codecompanion.adapters').extend('gemini', {
name = 'gemini_flash',
schema = {
model = {
default = 'gemini-2.0-flash',
},
},
})
end,
},
extensions = {
vectorcode = {
opts = {
add_tool = true,
add_slash_command = true,
tool_opts = {},
},
},
mcphub = {
callback = 'mcphub.extensions.codecompanion',
opts = {
make_slash_commands = true,
make_vars = true,
show_result_in_chat = true,
},
},
},
strategies = {
chat = { adapter = 'gemini_pro' },
inline = { adapter = 'gemini_flash' },
},
}
end,
keys = {
{
'<leader>aa',
'<cmd>CodeCompanionActions<cr>',
mode = { 'n', 'v' },
desc = 'CodeCompaion actions',
noremap = true,
silent = true,
},
{
'<leader>at',
'<cmd>CodeCompanionChat Toggle<cr>',
mode = { 'n', 'v' },
desc = 'CodeCompanion toggle chat',
noremap = true,
silent = true,
},
{
'ga',
'<cmd>CodeCompanionChat add<cr>',
mode = 'v',
desc = 'CodeCompanion add to chat',
noremap = true,
silent = true,
},
},
},

View File

@ -0,0 +1,4 @@
{
"host": "chroma",
"port": "8000"
}

View File

@ -21,11 +21,13 @@ services:
volumes:
- './config/atuin:/home/coder/.config/atuin'
- './config/git:/home/coder/.config/git'
- './config/mcphub:/home/coder/.config/mcphub'
- './config/mise:/home/coder/.config/mise'
- './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom'
- './config/starship:/home/coder/.config/starship'
- './config/tmux:/home/coder/.config/tmux'
- './config/tmuxp:/home/coder/.config/tmuxp'
- './config/vectorcode:/home/coder/.config/vectorcode'
- 'home_cache:/home/coder/.cache'
- 'home_local_share:/home/coder/.local/share'
- 'home_local_state:/home/coder/.local/state'
@ -42,7 +44,7 @@ services:
volumes:
- 'chroma_data:/data'
ports:
- '${IDE_CHROMA_PORT:-8000}'
- '${IDE_CHROMA_PORT:-18000:8000}'
volumes:
home_cache: {}