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
|
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"ray-x/cmp-treesitter",
},
config = function()
local cmp = require("cmp")
cmp.setup {
sources = {
{ name = "path" },
{ name = "lsp" },
{ name = "buffer" },
{ name = "treesitter" },
},
mapping = cmp.mapping.preset.insert {
--['<C-b>'] = cmp.mapping.scroll_docs(-4),
--['<C-f>'] = cmp.mapping.scroll_docs(4),
--['<C-Space>'] = cmp.mapping.complete(),
--['<C-e>'] = cmp.mapping.abort(),
--['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
['<Tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
}
end
}
|