dotfiles/.config/nvim/lua/plugins/cmp.lua
2022-10-05 22:44:12 -05:00

43 lines
1.1 KiB
Lua

local cmp = require('cmp')
cmp.setup{
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer', option = { keyword_length = 5 }, },
},
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},
}
-- Setup conjure, only for supported files
cmp.setup.filetype('racket', {
sources = {
{ name = 'conjure' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer', option = { keyword_length = 5 }, },
}
})