From 188ebccd6278a05571aee756841ea0f337ea7179 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 28 Sep 2022 18:48:38 +0200 Subject: vim: adjust cmp keybinds make jumping through snippets more intuitive add doc scrolling --- .vim/lua/plugins.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index c15d6fb..d3c9646 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -500,8 +500,8 @@ require('packer').startup({function() [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() + elseif luasnip.jumpable(1) then + luasnip.jump(1) else fallback() end @@ -543,9 +543,20 @@ require('packer').startup({function() end, }), [''] = cmp.mapping({ + i = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, s = function(fallback) if cmp.visible() then cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) else fallback() end @@ -573,6 +584,8 @@ require('packer').startup({function() fallback() end end, { 'i', 's'}), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), }, snippet = { expand = function(args) -- cgit 1.4.1