feat: codecompanion.nvim

This commit is contained in:
iofq 2025-02-06 02:48:48 -06:00
parent 55bade6fb7
commit b4404d2c1f
6 changed files with 69 additions and 46 deletions

12
flake.lock generated
View file

@ -139,11 +139,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1738410390,
"narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=",
"lastModified": 1738680400,
"narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3a228057f5b619feb3186e986dbe76278d707b6e",
"rev": "799ba5bffed04ced7067a91798353d360788b30d",
"type": "github"
},
"original": {
@ -167,11 +167,11 @@
},
"nixpkgs-master": {
"locked": {
"lastModified": 1738557153,
"narHash": "sha256-KbuxOVz6SCBCkjJufqmdhItzhf8OCBKnRP+JWE9EFlo=",
"lastModified": 1738831044,
"narHash": "sha256-6y2I2h4hX8d+LXLCzgu7QJ3Wvkx89R0x3WFQ5ovhwco=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3d89be6655a3ca15643456199b491b524929f61c",
"rev": "e4b6440d7ca1649bb95bd59f39b2279db959e498",
"type": "github"
},
"original": {

View file

@ -14,11 +14,11 @@ with final.pkgs.lib; let
all-plugins = with pkgs.vimPlugins; [
aerial-nvim
avante-nvim
inputs.nixpkgs-master.legacyPackages.${pkgs.system}.vimPlugins.blink-cmp
blink-cmp-copilot
blink-compat
blink-ripgrep-nvim
codecompanion-nvim
copilot-lua
diffview-nvim
eyeliner-nvim

View file

@ -2,10 +2,19 @@ return {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
keys = {
{
'M-\\',
'<cmd>Copilot panel<CR>',
noremap = true,
desc = 'Copilot panel'
}
},
opts = {
panel = { enabled = false },
panel = { enabled = true, keymap = { accept = "ga" } },
suggestion = {
enabled = true,
auto_trigger = true,
keymap = {
accept = "<M-]>",
next = "<M-[>",
@ -43,36 +52,50 @@ return {
}
},
{
"yetone/avante.nvim",
"olimorris/codecompanion.nvim",
cmd = "Copilot",
dependencies = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-treesitter/nvim-treesitter",
"zbirenbaum/copilot.lua",
{
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
opts = {
provider = "copilot",
-- auto_suggestions_provider = "copilot",
behavior = {
auto_suggestions = false, -- TODO
adapters = {
copilot = function()
return require("codecompanion.adapters").extend("copilot", {
name = "copilot-claude-3.5-sonnet",
schema = { model = "claude-3.5-sonnet", },
})
end
},
file_selector = {
provider = "native", -- TODO snacks once it's ready
strategies = {
chat = { adapter = "copilot-claude-3.5-sonnet", },
inline = { adapter = "copilot-claude-3.5-sonnet", },
},
windows = {
width = 50,
ask = {
floating = true
}
},
init = function()
vim.api.nvim_create_user_command('CC', ':CodeCompanion', {})
end,
keys = {
{
'<leader>ac',
'<cmd>CodeCompanionChat Toggle<CR>',
noremap = true,
desc = 'Copilot chat toggle'
},
{
'<leader>as',
'<cmd>CodeCompanionChat Add<CR>',
noremap = true,
desc = 'Copilot chat add selection'
},
{
'<leader>aa',
'<cmd>CodeCompanionActions<CR>',
noremap = true,
desc = 'Copilot inline'
}
}
}
},
}

View file

@ -3,7 +3,6 @@ return {
'saghen/blink.cmp',
event = "VeryLazy",
dependencies = {
{ "yetone/avante.nvim", lazy = true },
'saghen/blink.compat',
'rafamadriz/friendly-snippets',
'giuxtaposition/blink-cmp-copilot',
@ -34,8 +33,7 @@ return {
"snippets",
"buffer",
"ripgrep",
"avante_commands",
"avante_mentions",
"copilot"
},
providers = {
ripgrep = {
@ -43,18 +41,12 @@ return {
name = "rg",
score_offset = -10,
},
avante_commands = {
name = "avante_commands",
module = "blink.compat.source",
score_offset = 90,
opts = {},
copilot = {
name = "copilot",
module = "blink-cmp-copilot",
score_offset = 100,
async = true,
},
avante_mentions = {
name = "avante_mentions",
module = "blink.compat.source",
score_offset = 1000,
opts = {},
}
}
},
keymap = {
@ -77,6 +69,8 @@ return {
}
},
menu = {
-- auto show in cmdline
auto_show = true,
draw = {
treesitter = { "lsp" },
columns = {

View file

@ -7,7 +7,8 @@ return {
{
'<leader>de',
'<cmd>Trouble diagnostics toggle focus=true<CR>',
{ noremap = true, desc = 'Trouble diagnostics' }
noremap = true,
desc = 'Trouble diagnostics'
}
}
},

View file

@ -164,10 +164,15 @@ return {
ring = {
storage = "memory",
},
picker = {
select = {
action = require('yanky.picker').actions.set_register("+")
}
}
},
keys = {
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" } },
{ "<leader>fp", "<cmd>YankyRingHistory<cr>", { mode = { "n", "x" }, noremap = true, silent = true, desc = 'Pick history (yanky.nvim)' } }
{ "<leader>fp", "<cmd>YankyRingHistory<cr>", mode = { "n", "x" }, noremap = true, silent = true, desc = 'Pick history (yanky.nvim)' }
},
},
}