From 52fb50b13c98924cb218b537a3d9c1ddee534b69 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 12 May 2025 08:56:26 +0200 Subject: [PATCH] feat: extract and configure code-companion --- neovim/codecompanion.lua | 26 ++++++++++++++++++++++++++ neovim/default.nix | 12 ++---------- neovim/keymaps.lua | 5 ++--- 3 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 neovim/codecompanion.lua diff --git a/neovim/codecompanion.lua b/neovim/codecompanion.lua new file mode 100644 index 0000000..7e5a379 --- /dev/null +++ b/neovim/codecompanion.lua @@ -0,0 +1,26 @@ +local codecompanion = require("codecompanion") + +codecompanion.setup({ + strategies = { + chat = { + adapter = "copilot", + }, + inline = { + adapter = "copilot", + }, + cmd = { + adapter = "copilot", + }, + }, + adapters = { + copilot = function() + return require("codecompanion.adapters").extend("copilot", { + schema = { + model = { + default = "claude-3.7-sonnet", + }, + }, + }) + end, + } +}) diff --git a/neovim/default.nix b/neovim/default.nix index 4507a44..56f2207 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -179,16 +179,7 @@ }, }) - require('codecompanion').setup({ - strategies = { - chat = { - adapter = "copilot", - }, - inline = { - adapter = "copilot", - }, - }, - }) + require("local_codecompanion") require("diffview").setup({ view = { @@ -231,4 +222,5 @@ home.file.".config/nvim/lua/local_illuminate.lua".source = ./illuminate.lua; home.file.".config/nvim/lua/local_wilder.lua".source = ./wilder.lua; home.file.".config/nvim/lua/local_firenvim.lua".source = ./firenvim.lua; + home.file.".config/nvim/lua/local_codecompanion.lua".source = ./codecompanion.lua; } diff --git a/neovim/keymaps.lua b/neovim/keymaps.lua index dd52a7a..b37e1f7 100644 --- a/neovim/keymaps.lua +++ b/neovim/keymaps.lua @@ -64,6 +64,5 @@ nnoremap("gq", ":Bdelete") -- toggle search highlighting vim.cmd('nnoremap * v:hlsearch ? ":nohlsearch" : "*"') --- open Copilot Chat window -nnoremap("cc", ":lua require('CopilotChat').open()") -nnoremap("C", ":CodeCompanionChat #buffer") +-- open CodeCompanion chat window +nnoremap("cc", ":CodeCompanionChat #buffer{watch} #lsp @full_stack_dev")