local cmp = require("cmp") cmp.setup({ snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() -- Insert a tab character if no menu is visible end end, { 'i' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() -- Reverse tab character if no menu is visible end end, { 'i' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.confirm({ select = true }) -- Confirm the selected item else fallback() -- Insert a newline if no menu is visible end end, { 'i' }), }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' }, }, { { name = 'buffer' }, { name = 'path' }, }) })