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

different complete behavier when open a file directly and enter nvim then use `e` command.

Open lee-shun opened this issue 1 year ago • 1 comments

Hello!

my environment: nvim-0.9 + Windows 10 set shell? cmd.exe

  • When I use nvim to directly edit an existing file with nvim the_file.vim, it was like: image

  • But when I enter nvim first and then use e the_file.vim it was like: image

Apparently, for the same buffer, the completion items are so different!

I provide the following minimal config for you to debug:

  1. init.vim
let $CONF_PATH = split(&runtimepath, ',')[0]
set runtimepath+=$CONF_PATH/dein/repos/github.com/Shougo/dein.vim

let s:dein_dir = $CONF_PATH.'/dein'
let s:dein_src = $CONF_PATH.'/dein/repos/github.com/Shougo/dein.vim'

call dein#begin(s:dein_dir)
call dein#add('prabirshrestha/asyncomplete-buffer.vim', {'lazy':1,
            \})

call dein#add('kitagry/asyncomplete-tabnine.vim', { 'lazy':1,
			\'build': 'powershell.exe .\install.ps1' })

let g:asyncomplete_conf = { 'lazy':1,
			\'depends': ['asyncomplete-tabnine.vim', 'asyncomplete-buffer.vim'],
			\'on_event': ['BufReadPre', 'BufNew'],
			\'hook_source':'let g:asyncomplete_auto_popup = 1',
			\'hook_post_source':'source $CONF_PATH/after_test.vim'}

call dein#add('prabirshrestha/asyncomplete.vim', g:asyncomplete_conf)

call dein#end()

filetype indent plugin on

" Enable syntax highlighting
if has('syntax')
	syntax on
endif
  1. after_test.vim
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>"

if dein#tap('asyncomplete-tabnine.vim')
    call asyncomplete#register_source(asyncomplete#sources#tabnine#get_source_options({
                \ 'name': 'tabnine',
                \ 'allowlist': ['*'],
                \ 'completor': function('asyncomplete#sources#tabnine#completor'),
                \ 'config': {
                \   'line_limit': 1000,
                \   'max_num_result': 4,
                \  },
                \ }))
endif
" buffer
call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
            \ 'name': 'buffer',
            \ 'allowlist': ['*'],
            \ 'completor': function('asyncomplete#sources#buffer#completor'),
            \ 'config': {
            \    'max_buffer_size': 5000000,
            \   'max_num_result': 4,
            \  },
            \ }))

lee-shun avatar May 09 '23 14:05 lee-shun

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.

stale[bot] avatar Sep 17 '23 10:09 stale[bot]