Nvim: fix luasnip keymappings
This commit is contained in:
parent
747b4b8990
commit
8a3fb3ad45
2 changed files with 6 additions and 25 deletions
|
@ -32,7 +32,7 @@ return function()
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
}),
|
}),
|
||||||
["<Tab>"] = function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
@ -40,8 +40,8 @@ return function()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end,
|
end, { "i", "s" }),
|
||||||
["<S-Tab>"] = function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif luasnip.jumpable(-1) then
|
||||||
|
@ -49,7 +49,7 @@ return function()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end,
|
end, { "i", "s" }),
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "copilot" },
|
{ name = "copilot" },
|
||||||
|
|
|
@ -1,23 +1,4 @@
|
||||||
return function()
|
return function()
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local wk = require("which-key")
|
|
||||||
|
|
||||||
-- load friendly-snippets to luasnip
|
-- load friendly-snippets to luasnip
|
||||||
require("luasnip/loaders/from_vscode").lazy_load()
|
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"})
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue