diff options
Diffstat (limited to 'lua/cmp.lua')
| -rw-r--r-- | lua/cmp.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/cmp.lua b/lua/cmp.lua new file mode 100644 index 0000000..ec6695f --- /dev/null +++ b/lua/cmp.lua @@ -0,0 +1,35 @@ +local status, cmp = pcall(require, "cmp") +if not status then + return +end + +local status, luasnip = pcall(require, "luasnip") +if not status then + return +end + + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. + ['<C-e>'] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }, + sources = { +-- { name = 'nvim_lsp' }, +-- { name = 'luasnip' }, +-- { name = 'buffer' }, +-- { name = "path" }, + }, +}) |
