return { { 'VonHeikemen/lsp-zero.nvim', branch = 'v4.x', dependencies = { 'neovim/nvim-lspconfig', 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', 'hrsh7th/nvim-cmp', 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', }, config = function () local lsp_zero = require('lsp-zero') local lsp_attach = function (client, bufnr) lsp_zero.default_keymaps({ buffer = bufnr, preserve_mappings = false }) end lsp_zero.extend_lspconfig({ lsp_attach = lsp_attach, }) require('mason').setup({}) require('mason-lspconfig').setup({ ensure_installed = {}, handlers = { function (server_name) require('lspconfig')[server_name].setup({}) end, }, }) local cmp = require('cmp') cmp.setup({ sources = { {name = 'nvim_lsp'}, }, mapping = { [''] = cmp.mapping.confirm({select = false}), [''] = cmp.mapping.abort(), [''] = cmp.mapping.select_prev_item({behavior = 'select'}), [''] = cmp.mapping.select_next_item({behavior = 'select'}), [''] = cmp.mapping(function() if cmp.visible() then cmp.select_prev_item({behavior = 'insert'}) else cmp.complete() end end), [''] = cmp.mapping(function() if cmp.visible() then cmp.select_next_item({behavior = 'insert'}) else cmp.complete() end end), }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, }) end }, }