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

This commit is contained in:
Sergio Laín 2024-02-03 13:04:15 +01:00
parent e939bb0e08
commit 715c313918
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 22 additions and 3 deletions

View file

@ -1,8 +1,8 @@
{
"all": {
"cachedState": {
"date": "2024-01-26T23:03:18.822Z",
"value": true
"date": "2024-02-02T18:56:21.793Z",
"value": false
},
"general": {
"showButton": true,

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" },
},