local cmp = require'cmp' cmp.setup({ snippet = { expand = function(args) vim.snippet.expand(args.body) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = { [''] = function(fallback) if cmp.visible() then if not cmp.select_next_item() then if vim.bo.buftype ~= 'prompt' and has_words_before() then cmp.complete() else fallback() end end else return vim.cmd(">") end end, [''] = function(fallback) if cmp.visible() then if not cmp.select_prev_item() then if vim.bo.buftype ~= 'prompt' and has_words_before() then cmp.complete() else fallback() end end else return vim.cmd("<") end end, [''] = cmp.mapping.confirm({ select = true }), }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'buffer' }, }) })