nvim: Replace copilot.vim with copilot.lua

Makes the plugin less intrusive (will now only autocomplete on <M-p> or
<leader>ap). Can select suggestion with <M-]> or <M-[>, and accept with
<M-p> in-text or <CR> in-panel.

Still automatically started when invoking CodeCompanion chat.
This commit is contained in:
Marty Oehme 2025-06-06 15:47:01 +02:00
parent f160a5b4a7
commit 9efbcbfa01
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 25 additions and 2 deletions

View file

@ -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" },

View file

@ -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 = "<M-p>" } },
},
keys = {
{
"<leader>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