Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lee-shun opened this issue May 9, 2023 · 1 comment
Labels

Comments

@lee-shun
Copy link

lee-shun commented May 9, 2023

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,
            \  },
            \ }))
@stale
Copy link

stale bot commented Sep 17, 2023

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 stale bot added the wontfix label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant