From 9efbcbfa01ab5dd82cf8e39777a3685fa32dbb67 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 6 Jun 2025 15:47:01 +0200 Subject: [PATCH] nvim: Replace copilot.vim with copilot.lua Makes the plugin less intrusive (will now only autocomplete on or ap). Can select suggestion with or , and accept with in-text or in-panel. Still automatically started when invoking CodeCompanion chat. --- nvim/.config/nvim/lazy-lock.json | 2 +- nvim/.config/nvim/lua/plugins/llm.lua | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 9cea8da..ec6a5bd 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -10,7 +10,7 @@ "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, "codecompanion.nvim": { "branch": "main", "commit": "73bac3b52d9b7f52e89ac6698dd7df8962f0454c" }, "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, - "copilot.vim": { "branch": "release", "commit": "7167958954532a0a1b83f2db2f591b43aebff44c" }, + "copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" }, "dial.nvim": { "branch": "master", "commit": "2c7e2750372918f072a20f3cf754d845e143d7c9" }, "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "fidget.nvim": { "branch": "main", "commit": "b61e8af9b8b68ee0ec7da5fb7a8c203aae854f2e" }, diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/plugins/llm.lua index 0307ceb..a4177f3 100644 --- a/nvim/.config/nvim/lua/plugins/llm.lua +++ b/nvim/.config/nvim/lua/plugins/llm.lua @@ -1,11 +1,34 @@ return { + { + -- NOTE: Requires manual auth with ':Copilot auth' or 'GH_COPILOT_TOKEN' set as envvar + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + opts = { + panel = { layout = { position = "bottom" } }, + suggestion = { keymap = { accept = "" } }, + }, + keys = { + { + "ap", + function() + -- FIXME: If opening before lazy-loaded, errors + require("copilot.panel").open({}) + require("copilot.panel").refresh() + end, + desc = "Refresh Copilot Panel", + silent = true, + mode = { "n" }, + }, + }, + }, -- TODO: Add completion w blink, see https://codecompanion.olimorris.dev/installation.html { "olimorris/codecompanion.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - "github/copilot.vim", + "zbirenbaum/copilot.lua", }, init = function(_) if require("core.util").is_available("which-key") then