-- TODO: Improve docs -- Setup nvim-cmp. local cmp = require'cmp' -- Ensure vsnip is installed require'cmp_vsnip' cmp.setup({ snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), [''] = cmp.mapping.confirm({ select = true }), [''] = function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() end end, [''] = function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' }, }, { { name = 'buffer' }, }), }) -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline('/', { sources = { { name = 'buffer' } } }) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }) }) return { cmp = cmp }