43 lines
1.1 KiB
Lua
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 = 4 }, },
|
|
},
|
|
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 = 4 }, },
|
|
}
|
|
})
|