Replies: 1 comment
-
Did you figure it out in the last two years lol? If you haven't, here is the solution: cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline({
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- that way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'c' }),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'c' }),
}),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline({
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- that way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'c' }),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'c' }),
}),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
matching = { disallow_symbol_nonprefix_matching = false }
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have been trying to make
<Down>
and<Up>
arrows work for autocompletions in the command mode.Here's what my current setup looks like:
And while I am able to use the arrows to move between autocompletion items in the insert mode (i.e. when writing code), the autocompletion dialog closes immediately when I'm in the
c
mode (i.e. autocompleting a:
command.) The default<C-n>
and<C-p>
bindings work just fine.Does anybody have a clue as to what might be happening here? This is the output of
cmap
showing the c mode bindings:Beta Was this translation helpful? Give feedback.
All reactions