Skip to content

Commit

Permalink
Add pum#update_current_item()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jun 25, 2023
1 parent 11b219c commit b05f66c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/pum.vim
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ function pum#current_item() abort
return info.items->get(info.selected, {})
endfunction

function pum#update_current_item(dict) abort
call extend(pum#current_item(), a:dict)

if '#User#PumCompleteChanged'->exists()
doautocmd <nomodeline> User PumCompleteChanged
endif
endfunction

function pum#get_pos() abort
if !pum#visible()
return {}
Expand Down
14 changes: 14 additions & 0 deletions doc/pum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ pum#complete_info([{what}])
If {what} is supplied, then only the items listed in {what}
are returned.

*pum#current_item()*
pum#current_item()
Get current cursor item.

*pum#entered()*
pum#entered()
Returns |v:true| if you have selected or inserted popup menu.
Expand Down Expand Up @@ -334,6 +338,12 @@ pum#skip_complete()
If it is |v:true|, auto completion plugin must be skipped auto
completion.

*pum#update_current_item()*
pum#update_current_item({dict})
Update current cursor item by {dict}.
It executes |PumCompleteChanged| autocmd.
NOTE: It does not redraw current popup menu.

*pum#visible()*
pum#visible()
Returns |v:true| if the popup menu is visible like
Expand Down Expand Up @@ -427,6 +437,10 @@ PumCompleteDone
Note: When |v:completed_item| is not read only and insert
mode, |CompleteDone| is also called.

*PumCompleteDonePre*
PumCompleteDonePre
It is called before |PumCompleteDone| like |CompleteDonePre|.
|g:pum#completed_item| gives the completed item.

==============================================================================
EXAMPLES *pum-examples*
Expand Down

0 comments on commit b05f66c

Please sign in to comment.