feat: select_next_item and select_prev_item support "count" option. deafults to 1 (#1262)

User can increase count value to select item with pagedown/pageup.

- cmp.select_prev_item({ behavior = behavior, count = 8 })
- cmp.select_next_item({ behavior = behavior, count = 8 })
This commit is contained in:
ADoyle
2022-11-09 18:26:20 +08:00
committed by GitHub
parent c8d4afdad6
commit bdfadc1238
5 changed files with 72 additions and 33 deletions

View File

@@ -169,11 +169,11 @@ NOTE: `<Cmd>lua require('cmp').complete()<CR>` can be used to call these functio
*cmp.abort* ()
Closes the completion menu and restore the current line to the state before the current completion was started.
*cmp.select_next_item* (option: { behavior = cmp.SelectBehavior })
Select the next item.
*cmp.select_next_item* (option: { behavior = cmp.SelectBehavior, count = 1 })
Select the next item. Set count with large number to select pagedown.
*cmp.select_prev_item* (option: { behavior = cmp.SelectBehavior })*
Select the previous item.
*cmp.select_prev_item* (option: { behavior = cmp.SelectBehavior, count = 1 })
Select the previous item. Set count with large number to select pageup.
*cmp.scroll_docs* (delta: number)
Scroll the documentation window if visible.
@@ -292,10 +292,10 @@ There are also builtin mapping helper functions you can use:
*cmp.mapping.abort* ()
Same as |cmp.abort|.
*cmp.mapping.select_next_item* (option: { behavior = cmp.SelectBehavior })
*cmp.mapping.select_next_item* (option: { behavior = cmp.SelectBehavior, count = 1 })
Same as |cmp.select_next_item|.
*cmp.mapping.select_prev_item* (option: { behavior = cmp.SelectBehavior })
*cmp.mapping.select_prev_item* (option: { behavior = cmp.SelectBehavior, count = 1 })
Same as |cmp.select_prev_item|.
*cmp.mapping.scroll_docs* (delta: number)