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 38e505789d
commit 9b2434f755
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" },
},
@@ -32,7 +32,7 @@ return {
-- Start/end of line:
map({ "n", "x" }, "0", "<Cmd>lua Scroll('0')<CR>")
map({ "n", "x" }, "^", "<Cmd>lua Scroll('^')<CR>")
map({ "n", "x" }, "_", "<Cmd>lua Scroll('_')<CR>")
map({ "n", "x" }, "$", "<Cmd>lua Scroll('$', 0, 1)<CR>")
-- Paragraph movements: