dotfiles/neovim/.config/nvim/lua/completion.lua

27 lines
768 B
Lua
Raw Normal View History

2022-08-25 14:11:17 +02:00
local cmp = require("cmp")
cmp.setup({
-- snippet = {
-- expand = function(args)
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- end,
-- },
2022-08-25 14:11:17 +02:00
window = {
2023-10-19 19:53:56 +02:00
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
2022-08-25 14:11:17 +02:00
},
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(),
2023-10-19 19:53:56 +02:00
['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace }),
2022-08-25 14:11:17 +02:00
}),
sources = cmp.config.sources({
{ name = 'copilot', group_index = 2 },
{ name = 'nvim_lsp', group_index = 2 },
2023-10-19 19:53:56 +02:00
{ name = 'luasnip', group_index = 2 },
},{
2022-08-25 14:11:17 +02:00
{ name = 'buffer' },
})
})