[MINOR] Added <C-k> and <C-j> to navigate snippet fields
This commit is contained in:
parent
51dddb6fc9
commit
f6cd2eee6c
2 changed files with 20 additions and 2 deletions
|
@ -52,8 +52,6 @@ cmp.setup {
|
|||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
|
@ -64,6 +62,25 @@ cmp.setup {
|
|||
},
|
||||
-- Accept currently selected item. If none selected, do nothing.
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<C-k>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-j>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
|
|
|
@ -52,6 +52,7 @@ lazy.setup({
|
|||
'hrsh7th/cmp-path', --path completions
|
||||
'hrsh7th/cmp-cmdline', --cmdline completions
|
||||
'L3MON4D3/LuaSnip',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
},
|
||||
config = function()
|
||||
|
|
Loading…
Reference in a new issue