Change tab completion/snippet maps

Wed, 22 May 2024 21:14:12 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 22 May 2024 21:14:12 -0500
changeset 1173
79c1553aa040
parent 1172
e9fe1489c0a6
child 1174
753971334371

Change tab completion/snippet maps

.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
@@ -42,10 +42,10 @@ return {
           ["<C-b>"] = cmp.mapping.scroll_docs(-4),
           ["<C-f>"] = cmp.mapping.scroll_docs(4),
           ["<Tab>"] = cmp.mapping(function(fallback)
-            if cmp.visible() then
+            if vim.snippet.active({direction = 1}) then
+              vim.snippet.jump(1)
+            elseif cmp.visible() then
               cmp.select_next_item()
-            elseif vim.snippet.active({direction = 1}) then
-              vim.snippet.jump(1)
             elseif has_words_before() then
               cmp.complete()
             else
@@ -53,10 +53,10 @@ return {
             end
           end, { "i", "s" }),
           ["<S-Tab>"] = cmp.mapping(function(fallback)
-            if cmp.visible() then
+            if vim.snippet.active({direction = -1}) then
+              vim.snippet.jump(-1)
+            elseif cmp.visible() then
               cmp.select_prev_item()
-            elseif vim.snippet.active({direction = -1}) then
-              vim.snippet.jump(-1)
             else
               fallback()
             end

mercurial