From a55f39f71dfc2721b4f019be66c7a2632785af74 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 22 Sep 2024 14:00:02 +0200 Subject: [PATCH] Add code companion plugin and configure it to use Copilot on all accounts as that is promitted to use at work. Since it's using the official Copilot plugin we can be sure that the token is using whatever is authorized. --- home/.config/nvim/lua/plugs/codecompanion.lua | 36 +++++++++++++++++++ home/.config/nvim/lua/plugs/copilot.lua | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 home/.config/nvim/lua/plugs/codecompanion.lua diff --git a/home/.config/nvim/lua/plugs/codecompanion.lua b/home/.config/nvim/lua/plugs/codecompanion.lua new file mode 100644 index 0000000..f8c0077 --- /dev/null +++ b/home/.config/nvim/lua/plugs/codecompanion.lua @@ -0,0 +1,36 @@ +return { + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "hrsh7th/nvim-cmp", + { 'echasnovski/mini.diff', version = false }, + { "stevearc/dressing.nvim", opts = {} }, + }, + config = function() + require("codecompanion").setup({ + strategies = { + chat = { + adapter = "copilot", + }, + inline = { + adapter = "copilot", + }, + agent = { + adapter = "copilot", + }, + }, + adapters = { + copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end, + }, + display = { + diff = { + provider = "mini_diff", + }, + }, + opts = { + log_level = "DEBUG", + }, + }) + end +} diff --git a/home/.config/nvim/lua/plugs/copilot.lua b/home/.config/nvim/lua/plugs/copilot.lua index f46cbb3..c59d48c 100644 --- a/home/.config/nvim/lua/plugs/copilot.lua +++ b/home/.config/nvim/lua/plugs/copilot.lua @@ -1,4 +1,3 @@ return { "github/copilot.vim", - event = "InsertEnter", }