local cmp = require'cmp' local cmpStatus, cmp = pcall(require, "cmp") if (not cmpStatus) then print("cmp is not installed") return end cmp.setup({ snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping(function(fallback) if cmp.visible() then local entry = cmp.get_selected_entry() if not entry then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) else cmp.confirm() end else fallback() end end, {"i","s","c",}), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'buffer' }, }) })