35 lines
1.2 KiB
Lua
35 lines
1.2 KiB
Lua
local cmp = require("cmp")
|
|
|
|
return {
|
|
{
|
|
"hrsh7th/nvim-cmp",
|
|
dependencies = { "hrsh7th/cmp-emoji" },
|
|
opts = function(_, opts)
|
|
opts.mapping = cmp.mapping.preset.insert({
|
|
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.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.
|
|
["<S-CR>"] = cmp.mapping.confirm({
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = true,
|
|
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
["<C-CR>"] = function(fallback)
|
|
cmp.abort()
|
|
fallback()
|
|
end,
|
|
})
|
|
|
|
table.insert(opts.sources, { name = "emoji" })
|
|
|
|
opts.experimental = {
|
|
ghost_text = false,
|
|
}
|
|
|
|
return opts
|
|
end,
|
|
},
|
|
}
|