Skip to content

Commit 5eee0e6

Browse files
committed
Add blink.cmp-copilot
1 parent 63849cc commit 5eee0e6

File tree

2 files changed

+79
-5
lines changed

2 files changed

+79
-5
lines changed

config/nvim/lua/plugins/blink-cmp.lua

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@ return {
33
build = "cargo +nightly build --release",
44
opts = function(_, opts)
55
opts.sources = opts.sources or {}
6-
opts.sources.compat = opts.sources.compat or {}
7-
table.insert(opts.sources.compat, "copilot")
6+
opts.sources.providers = opts.sources.providers or {}
7+
opts.sources.providers.copilot = opts.sources.providers.copilot or {}
8+
9+
opts.sources.providers.copilot = {
10+
transform_items = function(_, items)
11+
local CompletionItemKind = require("blink.cmp.types").CompletionItemKind
12+
local kind_idx = #CompletionItemKind + 1
13+
CompletionItemKind[kind_idx] = "Copilot"
14+
for _, item in ipairs(items) do
15+
item.kind = kind_idx
16+
end
17+
return items
18+
end,
19+
}
20+
21+
-- opts.sources.compat = opts.sources.compat or {}
22+
-- table.insert(opts.sources.compat, "copilot")
823

924
-- Configure completion behavior
1025
opts.completion = opts.completion or {}
@@ -17,6 +32,44 @@ return {
1732
opts.keymap["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" }
1833
opts.keymap["<C-Space>"] = { "accept", "fallback" }
1934

35+
opts.appearance = opts.appearance or {}
36+
opts.appearance = {
37+
-- Blink does not expose its default kind icons so you must copy them all (or set your custom ones) and add Copilot
38+
kind_icons = {
39+
Copilot = "",
40+
Text = "󰉿",
41+
Method = "󰊕",
42+
Function = "󰊕",
43+
Constructor = "󰒓",
44+
45+
Field = "󰜢",
46+
Variable = "󰆦",
47+
Property = "󰖷",
48+
49+
Class = "󱡠",
50+
Interface = "󱡠",
51+
Struct = "󱡠",
52+
Module = "󰅩",
53+
54+
Unit = "󰪚",
55+
Value = "󰦨",
56+
Enum = "󰦨",
57+
EnumMember = "󰦨",
58+
59+
Keyword = "󰻾",
60+
Constant = "󰏿",
61+
62+
Snippet = "󱄽",
63+
Color = "󰏘",
64+
File = "󰈔",
65+
Reference = "󰬲",
66+
Folder = "󰉋",
67+
Event = "󱐋",
68+
Operator = "󰪚",
69+
TypeParameter = "󰬛",
70+
},
71+
}
72+
2073
return opts
2174
end,
2275
}

config/nvim/lua/plugins/copilot.lua

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ return {
77
config = function()
88
require("copilot").setup({
99
panel = {
10-
enabled = true,
10+
enabled = false,
1111
auto_refresh = false,
1212
keymap = {
1313
jump_prev = "[[",
@@ -22,7 +22,7 @@ return {
2222
},
2323
},
2424
suggestion = {
25-
enabled = true,
25+
enabled = false,
2626
auto_trigger = true,
2727
debounce = 75,
2828
keymap = {
@@ -35,7 +35,7 @@ return {
3535
},
3636
},
3737
filetypes = {
38-
yaml = tru,
38+
yaml = true,
3939
markdown = true,
4040
help = true,
4141
gitcommit = false,
@@ -49,4 +49,25 @@ return {
4949
})
5050
end,
5151
},
52+
{
53+
"saghen/blink.cmp",
54+
dependencies = {
55+
{
56+
"giuxtaposition/blink-cmp-copilot",
57+
},
58+
},
59+
opts = {
60+
sources = {
61+
default = { "lsp", "path", "snippets", "buffer", "copilot" },
62+
providers = {
63+
copilot = {
64+
name = "copilot",
65+
module = "blink-cmp-copilot",
66+
score_offset = 100,
67+
async = true,
68+
},
69+
},
70+
},
71+
},
72+
},
5273
}

0 commit comments

Comments
 (0)