return { "hrsh7th/nvim-cmp", -- Autocompletion plugin dependencies = { "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp "L3MON4D3/LuaSnip", -- Snippets plugin }, config = function() require('cmp').setup { snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, mapping = require('cmp').mapping.preset.insert({ [''] = require('cmp').mapping.scroll_docs(-4), -- Up [''] = require('cmp').mapping.scroll_docs(4), -- Down -- C-b (back) C-f (forward) for snippet placeholder navigation. [''] = require('cmp').mapping.complete(), [''] = require('cmp').mapping.confirm { behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, [''] = require('cmp').mapping(function(fallback) if require('cmp').visible() then require('cmp').select_next_item() elseif require('luasnip').expand_or_jumpable() then require('luasnip').expand_or_jump() else fallback() end end, { 'i', 's' }), [''] = require('cmp').mapping(function(fallback) if require('cmp').visible() then require('cmp').select_prev_item() elseif require('luasnip').jumpable(-1) then require('luasnip').jump(-1) else fallback() end end, { 'i', 's' }), }), sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'buffer' }, { name = 'path' }, }, } end, }