feat: Allow users to jump previous (#13)

This commit is contained in:
danymat
2022-01-07 19:44:41 +01:00
parent 72a82df7f2
commit d16557c3e6
3 changed files with 63 additions and 21 deletions

View File

@@ -114,20 +114,26 @@ cmp.setup {
-- You must set mapping if you want.
mapping = {
["<tab>"] = cmp.mapping(function(fallback)
if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(t("<C-n>"), "n")
elseif neogen.jumpable() then
vim.fn.feedkeys(t("<cmd>lua require('neogen').jump_next()<CR>"), "")
elseif check_back_space() then
vim.fn.feedkeys(t("<tab>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
["<tab>"] = cmp.mapping(function(fallback)
if neogen.jumpable() then
vim.fn.feedkeys(t("<cmd>lua require('neogen').jump_next()<CR>"), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-tab>"] = cmp.mapping(function(fallback)
if neogen.jumpable(-1) then
vim.fn.feedkeys(t("<cmd>lua require('neogen').jump_prev()<CR>"), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
...
}