prabirshrestha/asyncomplete.vim

Is it possible to insert completions without opening the pop-up menu?

Closed this issue · 1 comments

dgkf commented

Apologies if I've missed some documentation somewhere. I've spent a bit of time combing through issues with every search term I could think of and didn't turn anything up.

The behavior I'm after is to:

  1. Have a relatively long delay (let's say 1s) by default for the popup to show
  2. But when <Tab> is pressed, immediately
    a. Insert the completion when only a single completion is available (with no popup shown)
    b. Insert the common substring across all completions and show the completion popup when multiple completions are available

In the README, there is a key mapping listed for mapping <Tab> to show the popup, but it would be nice if it was extended to also insert a completion or substring of the completions. As well, if a long pop-up delay is set, the mapping in the README still waits for the duration of the delay before showing the popup, meaning that it's only really all that useful when auto-popup is disabled and the delay is 0.

You can use the above `<Plug>(asyncomplete_force_refresh)` to show the popup
or can you tab to show the autocomplete.
```vim
let g:asyncomplete_auto_popup = 0
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
```

I don't mind doing some customization to get this configured to my liking, but I'm having trouble getting started. I couldn't find a way to access and insert completions without opening the popup menu. Any pointers for functions that I should consider, or limitations that I would have to work around would be much appreciated.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.