diff options
| author | Robert Günzler <r@gnzler.io> | 2022-07-01 17:03:36 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-08-02 22:15:22 +0200 |
| commit | d517c03abbf4c7fa971bbe11035b7c3458590d35 (patch) | |
| tree | 074ff2c6e197ad360ce41a3f2d3e8480a35098eb /.vim/lua/plugins.lua | |
| parent | 9967b1702a7aa29232194f2c5dbf02d2b6e5bf0d (diff) | |
vim: some work on snippets
Diffstat (limited to '.vim/lua/plugins.lua')
| -rw-r--r-- | .vim/lua/plugins.lua | 21 |
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) |