Add nvim-cmp mappings
This commit is contained in:
parent
b663f3bb20
commit
d300288799
1 changed files with 12 additions and 1 deletions
|
|
@ -120,12 +120,23 @@ cmp.setup({
|
|||
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.menu = string.format('[%s]', entry.source.source.client.name)
|
||||
if entry.source.name == 'nvim_lsp' then
|
||||
vim_item.menu = entry.source.source.client.name
|
||||
end
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue