diff --git a/lua/crentist/lazy/lsp.lua b/lua/crentist/lazy/lsp.lua index f4b656e..9658311 100644 --- a/lua/crentist/lazy/lsp.lua +++ b/lua/crentist/lazy/lsp.lua @@ -29,7 +29,7 @@ return { require('mason-lspconfig').setup({ -- Replace the language servers listed here -- with the ones you want to install - ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls', 'ansiblels', 'terraformls'}, + ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls', 'ansiblels', 'terraformls' }, handlers = { function(server_name) require('lspconfig')[server_name].setup({}) @@ -46,20 +46,17 @@ return { }, mapping = cmp.mapping.preset.insert({ -- `Enter` key to confirm completion - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - if luasnip.expandable() then - luasnip.expand() + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) else - cmp.confirm({ - select = false, - }) + fallback() end - else - fallback() - end - end), - + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item()