From 00836c2e7ec4ea32fbf11742dc23d6eb420c2b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corintho=20Assun=C3=A7=C3=A3o?= Date: Fri, 17 May 2024 18:09:14 +0200 Subject: [PATCH] feat(completion): add `copilot-cmp` (#967) --- .../completion/copilot-cmp/README.md | 10 +++++++ .../completion/copilot-cmp/init.lua | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 lua/astrocommunity/completion/copilot-cmp/README.md create mode 100644 lua/astrocommunity/completion/copilot-cmp/init.lua diff --git a/lua/astrocommunity/completion/copilot-cmp/README.md b/lua/astrocommunity/completion/copilot-cmp/README.md new file mode 100644 index 000000000..918d916d5 --- /dev/null +++ b/lua/astrocommunity/completion/copilot-cmp/README.md @@ -0,0 +1,10 @@ +# copilot.lua within CMP + +Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot + +**Repositories:** + + + +_Note_: This plugin will also reconfigure `cmp` and add `copilot` as a completion source +_Note 2_: This configuration adds a nerdfont icon for copilot using `lspkind`. If you are using regular characters, you can change it in your plugin setup, using the key `Copilot` for `lspkind`'s `buffer_map` diff --git a/lua/astrocommunity/completion/copilot-cmp/init.lua b/lua/astrocommunity/completion/copilot-cmp/init.lua new file mode 100644 index 000000000..8a6658c76 --- /dev/null +++ b/lua/astrocommunity/completion/copilot-cmp/init.lua @@ -0,0 +1,29 @@ +---@type LazySpec +return { + { + "zbirenbaum/copilot.lua", + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + }, + }, + { "zbirenbaum/copilot-cmp", opts = {}, dependencies = { "zbirenbaum/copilot.lua" } }, + { + "hrsh7th/nvim-cmp", + dependencies = { "zbirenbaum/copilot-cmp" }, + opts = function(_, opts) + -- Inject copilot into cmp sources, with high priority + table.insert(opts.sources, 1, { + name = "copilot", + group_index = 1, + priority = 10000, + }) + end, + }, + { + "onsails/lspkind.nvim", + optional = true, + -- Adds icon for copilot using lspkind + opts = function(_, opts) opts.symbol_map.Copilot = "" end, + }, +}