1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
return {
{
'saghen/blink.cmp',
version = '1.*',
lazy = false,
dependencies = {
{ 'L3MON4D3/LuaSnip' },
},
init = function()
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.shortmess:append('c')
vim.opt.pumheight = 20 -- max height of completion window
local hl = vim.api.nvim_set_hl
hl(0, 'BlinkCmpSource', { link = 'Comment', force = true })
hl(0, 'BlinkCmpLabelDescription', { link = 'Comment', force = true })
end,
opts_extend = { 'sources.default' },
opts = {
-- TODO:
-- 'prefer_rust_with_warning', requires nightly rust, due to:
-- https://github.com/rust-lang/rust/issues/86656
fuzzy = {
implementation = 'lua',
sorts = {
function(a, b)
local prio = {
snippets = 99,
-- everyting else 0
}
local a_priority = prio[a.source_id] or 0
local b_priority = prio[b.source_id] or 0
if a_priority ~= b_priority then return a_priority > b_priority end
end,
-- defaults
'score',
'sort_text'
},
},
appearance = {
-- fallback to cmp highlight names
use_nvim_cmp_as_default = true,
-- adjusts spacing to ensure icons are aligned
-- nerd_font_variant = 'normal',
},
sources = {
providers = {
buffer = { min_keyword_length = 3 },
},
},
completion = {
documentation = { auto_show = true },
menu = {
draw = {
columns = {
{ 'kind_icon' },
{ 'label', 'label_description', gap = 1 },
{ 'source_name' },
},
},
},
},
signature = {
enabled = true,
window = { scrollbar = false }, -- BUG: weird artifacts
},
keymap = {
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-e>'] = { 'cancel', 'fallback' },
['<C-y>'] = { 'select_and_accept' },
['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },
['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
['<Tab>'] = { 'select_and_accept', 'fallback' },
['<C-j>'] = { 'snippet_forward', 'fallback' },
['<C-k>'] = { 'snippet_backward', 'fallback' },
-- ['<C-l>'] = { 'show', 'hide', 'fallback' },
},
snippets = { preset = 'luasnip' },
},
},
}
|