3

I have installed deoplete plugin into my Neovim using dein. I have put let g:deoplete#enable_at_startup = 1 into my init.vim and I can see the autocomplete list when I type in the insert mode - so far so good. However I am not able to autocomplete the word I am typing from the list which has appeared (I guess it should be done using Tab but none of the keys I tried worked). I am a Vim beginner so I am actually getting lost now.

5

Vim uses Ctrl-n (next item) and Ctrl-p (previous item), Ctrl-y (accept match) or Ctrl-e (cancel) and so on for completion. See :h ins-completion-menu and :h popupmenu-keys for details.

The following deoplete settings may help (they use Tab, Enter and Esc) - see the comments for what they do:

"use <tab> for completion
function! TabWrap()
    if pumvisible()
        return "\<C-N>"
    elseif strpart( getline('.'), 0, col('.') - 1 ) =~ '^\s*$'
        return "\<tab>"
    elseif &omnifunc !~ ''
        return "\<C-X>\<C-O>"
    else
        return "\<C-N>"
    endif
endfunction

" power tab
imap <silent><expr><tab> TabWrap()

" Enter: complete&close popup if visible (so next Enter works); else: break undo
inoremap <silent><expr> <Cr> pumvisible() ?
            \ deoplete#mappings#close_popup() : "<C-g>u<Cr>"

" Ctrl-Space: summon FULL (synced) autocompletion
inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()

" Escape: exit autocompletion, go to Normal mode
inoremap <silent><expr> <Esc> pumvisible() ? "<C-e><Esc>" : "<Esc>"
0

I've found that the Supertab plugin (https://github.com/ervandew/supertab) let me use tab for deoplete completions, without needing any additional configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.