You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to have a completion key which, when there is more than one match, scrolls downward through the list (like select_next) but when there is only one match, accepts it (like select_and_accept). I've tried chaining these like this:
... but that didn't work how I expected, it just acts like select_next even when there is only one match available. I am using to completion being very simple and it's tricky to get used to have to use different keys for these.
This is similar to (but not identical to) the menu option for NeoVim's built-in completeopt.
The text was updated successfully, but these errors were encountered:
Saghen
changed the title
Feature Request: Would be nice to be able to combine select_next and select_and_accept
Skip select_next for single item
Nov 2, 2024
Should this be handled by the plugin itself, or should we provide an API with the length of the items so the user can perform actions like this? @Saghen
-- ['<Tab>'] = {-- function(cmp)-- if #cmp.items == 1 then return cmp.accept() end-- if cmp.is_in_snippet() then return cmp.accept()-- else return cmp.select_and_accept() end-- end,-- 'snippet_forward',-- 'fallback'-- },
I think the latter. It's possible right now with #cmp.windows.autocomplete.items but that's an internal API which won't be exposed long term. Ideally the list isnt coupled with the autocomplete window, and instead, moved into a separate module, which also handles selection.
You may now write your own function for this using require('blink.cmp').get_items() and require('blink.cmp').get_selected_item_idx(). Please share what you come up with!
It would be nice to be able to have a completion key which, when there is more than one match, scrolls downward through the list (like
select_next
) but when there is only one match, accepts it (likeselect_and_accept
). I've tried chaining these like this:... but that didn't work how I expected, it just acts like
select_next
even when there is only one match available. I am using to completion being very simple and it's tricky to get used to have to use different keys for these.This is similar to (but not identical to) the
menu
option for NeoVim's built-incompleteopt
.The text was updated successfully, but these errors were encountered: