Nvim: fix luasnip keymappings

This commit is contained in:
Marko Korhonen 2023-10-04 13:17:43 +03:00
parent 747b4b8990
commit 8a3fb3ad45
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
2 changed files with 6 additions and 25 deletions

View file

@ -32,7 +32,7 @@ return function()
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = function(fallback)
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
@ -40,8 +40,8 @@ return function()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -49,7 +49,7 @@ return function()
else
fallback()
end
end,
end, { "i", "s" }),
},
sources = {
{ name = "copilot" },

View file

@ -1,23 +1,4 @@
return function()
local luasnip = require("luasnip")
local wk = require("which-key")
-- load friendly-snippets to luasnip
require("luasnip/loaders/from_vscode").lazy_load()
-- Register snippet navigation keybindings
local snippet_mappings = {
["<c-j>"] = {
function()
luasnip.jump(1)
end,
},
["<c-k>"] = {
function()
luasnip.jump(-1)
end,
},
}
--wk.register(snippet_mappings, {mode = "i"})
--wk.register(snippet_mappings, {mode = "s"})
-- load friendly-snippets to luasnip
require("luasnip/loaders/from_vscode").lazy_load()
end