-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
cmp.lua
66 lines (60 loc) · 1.6 KB
/
cmp.lua
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
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-path',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'petertriho/cmp-git',
},
opts = function()
local cmp = require 'cmp'
return {
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<c-space>'] = cmp.mapping.complete(),
['<c-y>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
},
sources = cmp.config.sources({
{ name = 'git' },
{ name = 'nvim_lsp' },
}, {
{ name = 'luasnip' },
}, {
{ name = 'cmp-path' },
{ name = 'buffer', keyword_length = 5 },
}),
matching = {
disallow_fuzzy_matching = true,
disallow_fullfuzzy_matching = true,
disallow_partial_fuzzy_matching = true,
disallow_partial_matching = false,
disallow_prefix_unmatching = true,
},
window = {
documentation = cmp.config.window.bordered {
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:Visual,Search:None',
},
},
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
}
end,
}