2
0
mirror of https://github.com/webgefrickel/dotfiles synced 2024-11-15 12:12:58 +00:00
steffen-dotfiles/nvim/lua/plugins/cmp.lua

57 lines
1.1 KiB
Lua
Raw Normal View History

2021-12-13 11:59:00 +00:00
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
2023-10-01 23:13:34 +00:00
vim.fn['vsnip#anonymous'](args.body)
2022-01-25 13:49:17 +00:00
end
2021-12-13 11:59:00 +00:00
},
2022-04-25 10:20:19 +00:00
mapping = cmp.mapping.preset.insert({
2021-12-13 11:59:00 +00:00
['<cr>'] = cmp.mapping.confirm({ select = true }),
2022-04-25 10:20:19 +00:00
}),
2021-12-13 11:59:00 +00:00
sources = cmp.config.sources({
2024-02-03 16:54:46 +00:00
{ name = 'copilot' },
2024-04-10 09:44:43 +00:00
{ name = 'codeium' },
2022-04-25 10:20:19 +00:00
{ name = 'nvim_lsp' },
2022-01-25 13:49:17 +00:00
{
2021-12-13 11:59:00 +00:00
name = 'buffer',
option = {
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end
},
},
{ name = 'path' },
2022-01-25 13:49:17 +00:00
{ name = 'vsnip' },
2021-12-13 11:59:00 +00:00
{ name = 'calc' },
}),
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
2024-02-03 16:54:46 +00:00
copilot = '[Copilot]',
2024-04-10 09:44:43 +00:00
codeium = '[Codeium]',
2023-10-01 23:13:34 +00:00
nvim_lsp = '[LSP]',
buffer = '[Buffer]',
path = '[Path]',
vsnip = '[Snippet]',
calc = '[Calc]',
2021-12-13 11:59:00 +00:00
})[entry.source.name]
return vim_item
end
},
})
2021-12-14 11:09:35 +00:00
cmp.setup.cmdline(':', {
2022-04-25 10:20:19 +00:00
mapping = cmp.mapping.preset.cmdline({}),
2021-12-14 11:09:35 +00:00
sources = {
{ name = 'cmdline' }
}
})
cmp.setup.cmdline('/', {
2022-04-25 10:20:19 +00:00
mapping = cmp.mapping.preset.cmdline({}),
2021-12-14 11:09:35 +00:00
sources = {
{ name = 'buffer' }
}
})