local cmp = require('cmp') vim.cmd([[ autocmd FileType TelescopePrompt lua require('cmp').setup.buffer { enabled = false } ]]) cmp.setup({ snippet = { expand = function(args) require'luasnip'.lsp_expand(args.body) end, }, mapping = { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.close(), [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, 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, }, documentation = { border = 'single', winhighlight = 'FloatBorder:FloatBorder,Normal:Normal', }, experimental = { ghost_text = true, }, sources = { { name = 'nvim_lsp' }, { name = 'buffer' }, { name = 'luasnip' }, { name = 'nvim_lua' }, { name = 'path' }, }, formatting = { format = require('lspkind').cmp_format({ with_text = true, menu = { nvim_lsp = '[LSP]', buffer = '[Buf]', luasnip = '[LSnip]', nvim_lua = '[Lua]', }, }), }, }) require('nvim-autopairs').setup({ disable_filetype = { 'TelescopePrompt', 'vim' }, }) require('nvim-autopairs.completion.cmp').setup({ map_cr = true, -- map on insert mode map_complete = true, -- it will auto insert `(` (map_char) after select function or method item auto_select = true, -- automatically select the first item insert = false, -- use insert confirm behavior instead of replace map_char = { -- modifies the function or method delimiter by filetypes all = '(', tex = '{', }, })