local cmp = require('cmp') cmp.setup({ completion = { keyword_length = 1, -- TODO set this back 3, when fine with snippets }, snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { [''] = cmp.mapping.confirm({ select = true }), }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' }, { name = 'buffer', option = { get_bufnrs = function() return vim.api.nvim_list_bufs() end }, }, { name = 'path' }, { name = 'tmux', option = { all_panes = true } }, -- TODO 'true' makes things sloppy { name = 'calc' }, }), formatting = { format = function(entry, vim_item) vim_item.menu = ({ buffer = "[Buffer]", calc = "[Calc]", nvim_lsp = "[LSP]", path = "[Path]", tmux = "[tmux]", vsnip = "[Snippet]", })[entry.source.name] return vim_item end }, })