Skip to content

Commit

Permalink
feat(completion): add copilot-cmp (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
corintho authored May 17, 2024
1 parent c547c9e commit 00836c2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lua/astrocommunity/completion/copilot-cmp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# copilot.lua within CMP

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot

**Repositories:**
<https://github.com/zbirenbaum/copilot.lua>
<https://github.com/zbirenbaum/copilot-cmp>

_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`
29 changes: 29 additions & 0 deletions lua/astrocommunity/completion/copilot-cmp/init.lua
Original file line number Diff line number Diff line change
@@ -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,
},
}

0 comments on commit 00836c2

Please sign in to comment.