feat(nvim): add new mappings for selecting next and prev item in the cmp cmdline

This commit is contained in:
sankalp committed 2024-02-03 18:46:46 +05:45
1 parent e3d65eba91
commit 3dd73f914c
4 files changed
+39 -16

No files matched your search

+20 -1
View File
@@ -57,7 +57,26 @@ return {
}
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
mapping = cmp.mapping.preset.cmdline({
["<C-j>"] = {
c = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
},
["<C-k>"] = {
c = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},
}),
sources = {
{ name = "buffer" },
},