Fix jumping in autocompletions
This commit is contained in:
parent
eb25cb1667
commit
bf8360bebe
2 changed files with 20 additions and 19 deletions
|
|
@ -16,6 +16,18 @@ return {
|
|||
config = function()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load({ paths = "./snippets" })
|
||||
local ls = require("luasnip")
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<leader>j", function()
|
||||
if ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ "i", "s" }, "<leader>k", function()
|
||||
if ls.locally_jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
local snip = ls.snippet
|
||||
local node = ls.snippet_node
|
||||
local text = ls.text_node
|
||||
|
|
@ -104,17 +116,6 @@ return {
|
|||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
|
||||
["<leader>j"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<leader>k"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue