simplify nvim-cmp setup

Sat, 18 May 2024 10:56:07 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 18 May 2024 10:56:07 -0500
changeset 1168
52750027eff6
parent 1167
f5f84f890974
child 1169
db64f7947671

simplify nvim-cmp setup

.config/nvim/lua/plugins/completion.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/plugins/completion.lua
+++ b/.config/nvim/lua/plugins/completion.lua
@@ -63,19 +63,11 @@ return {
             end
           end, { "i", "s" }),
           ["<C-g>"] = cmp.mapping.abort(),
-          ["<Right>"] = cmp.mapping.confirm({ select = true }),
           ["<C-Space>"] = cmp.mapping.complete(),
-          ["<Space>"] = function(fallback)
-            local e = cmp.get_active_entry()
-            if cmp.visible() and e then
-              cmp.confirm({ select = false }, function()
-                if e:get_kind() ~= cmp.lsp.CompletionItemKind.Snippet then
-                  vim.api.nvim_feedkeys(" ", "n", false)
-                end
-              end)
-            end
+          ["<Space>"] = cmp.mapping(function(fallback)
+            cmp.confirm({ select = false })
             fallback()
-          end,
+          end, { "i", "s" }),
         }),
         sources = cmp.config.sources({
           { name = "nvim_lsp" },

mercurial