asyncomplete-buffer.vim icon indicating copy to clipboard operation
asyncomplete-buffer.vim copied to clipboard

Regression with commit 'b88179d'

Open ipkiss42 opened this issue 6 years ago • 2 comments

The latest commit (b88179d) introduced a regression.

To reproduce, create a file with the following contents:

hello
h

Then on the last line type e. The word hello is not proposed.

However if you do the same at commit b8f00ea it works as expected.

ipkiss42 avatar Mar 07 '20 15:03 ipkiss42

I managed to fix it locally by faking a BufWinEnter event on the buffer source like so:

autocmd User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
    \ 'name': 'buffer',
    \ 'allowlist': ['*'],
    \ 'blocklist': [],
    \ 'completor': function('asyncomplete#sources#buffer#completor'),
    \ 'config': {
    \    'max_buffer_size': 5000000,
    \  },
    \ }))

" fix for https://github.com/prabirshrestha/asyncomplete-buffer.vim/issues/17
function! s:fix_buffer_complete() abort
    let l:info = asyncomplete#get_source_info('buffer')
    call l:info.on_event(l:info, {}, 'BufWinEnter')
endfunction
autocmd User asyncomplete_setup call s:fix_buffer_complete()

ferreum avatar Jul 13 '22 12:07 ferreum

It seems that the event BufWinEnter is not generated when you start vim with a file. A proper fix for the plugin would be to process not only BufWinEnter, but also VimEnter.

I have found a workaround for this issue by adding this to my vimrc (I am not sure if this is the right approach):

autocmd VimEnter * :doautocmd BufWinEnter

jcomesana avatar Dec 08 '22 22:12 jcomesana