vim: navigate up/down completions with <c-j>/<c-k>
This commit is contained in:
parent
fee0d0f5c7
commit
f39ac9a666
1 changed files with 4 additions and 0 deletions
|
@ -4,6 +4,7 @@ local make_keymap = function(cmp)
|
||||||
local select = { behavior = cmp.SelectBehavior.Select }
|
local select = { behavior = cmp.SelectBehavior.Select }
|
||||||
|
|
||||||
local if_visible = function(yes, no)
|
local if_visible = function(yes, no)
|
||||||
|
no = no or function(fallback) fallback() end
|
||||||
return function(fallback)
|
return function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
yes(fallback)
|
yes(fallback)
|
||||||
|
@ -19,6 +20,9 @@ local make_keymap = function(cmp)
|
||||||
["<c-n>"] = if_visible(cmp.mapping.select_next_item(select), cmp.mapping.complete()),
|
["<c-n>"] = if_visible(cmp.mapping.select_next_item(select), cmp.mapping.complete()),
|
||||||
["<c-p>"] = if_visible(cmp.mapping.select_prev_item(select), cmp.mapping.complete()),
|
["<c-p>"] = if_visible(cmp.mapping.select_prev_item(select), cmp.mapping.complete()),
|
||||||
|
|
||||||
|
["<c-j>"] = if_visible(cmp.mapping.select_next_item(select), cmp.mapping.complete()),
|
||||||
|
["<c-k>"] = if_visible(cmp.mapping.select_prev_item(select)),
|
||||||
|
|
||||||
["<down>"] = cmp.mapping.select_next_item(select),
|
["<down>"] = cmp.mapping.select_next_item(select),
|
||||||
["<up>"] = cmp.mapping.select_prev_item(select),
|
["<up>"] = cmp.mapping.select_prev_item(select),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue