summary refs log tree commit diff
path: root/.vim/lua/plugins.lua
diff options
context:
space:
mode:
Diffstat (limited to '.vim/lua/plugins.lua')
-rw-r--r--.vim/lua/plugins.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua
index eb62b1e..67a0e88 100644
--- a/.vim/lua/plugins.lua
+++ b/.vim/lua/plugins.lua
@@ -504,8 +504,8 @@ require('packer').startup({function()
               i = function(fallback)
                 if cmp.visible() then
                   cmp.confirm({ select = true })
-                elseif luasnip.expandable() then
-                  luasnip.expand()
+                elseif luasnip.expand_or_jumpable() then
+                  luasnip.expand_or_jump()
                 else
                   fallback()
                 end
@@ -513,6 +513,8 @@ require('packer').startup({function()
               s = function(fallback)
                 if cmp.visible() then
                   cmp.select_next_item()
+                elseif luasnip.expand_or_jumpable() then
+                  luasnip.expand_or_jump()
                 else
                   fallback()
                 end
@@ -541,6 +543,21 @@ require('packer').startup({function()
                 end
               end,
             }),
+          -- map c-j/k for luasnip choice nodes
+          ['<c-j>'] = cmp.mapping(function(fallback)
+              if luasnip.choice_active() then
+                luasnip.change_choice(1)
+              else
+                fallback()
+              end
+            end, { 'i', 's'}),
+          ['<c-k>'] = cmp.mapping(function(fallback)
+              if luasnip.choice_active() then
+                luasnip.change_choice(-1)
+              else
+                fallback()
+              end
+            end, { 'i', 's'}),
         },
         snippet = {
           expand = function(args)