Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manual completion with Ctrl-N in Deoplete

I installed deoplete and it works for me, however by default it opens a pop-up window whenever you type something. This is not desirable. I want pop-up to only show when I hit Ctrl+N. So I disable autocompletion:

let b:deoplete_disable_auto_complete = 1

But that makes Ctrl+N behave as it did before deoplete, that is use all words in the buffer as completion source.

I also tried adding the code from the docs, to no avail:

            inoremap <silent><expr> <TAB>
            \ pumvisible() ? "\<C-n>" :
            \ <SID>check_back_space() ? "\<TAB>" :
            \ deoplete#mappings#manual_complete()
            function! s:check_back_space() abort "{{{
            let col = col('.') - 1
            return !col || getline('.')[col - 1]  =~ '\s'
            endfunction"}}}

It remaps the Tab key, but not Ctrl+N. Is it possible to show Deoplete manual completion by pressing Ctrl+N?

like image 572
Michael Ivko Avatar asked Oct 29 '22 23:10

Michael Ivko


1 Answers

I admit I'm slightly puzzled as to the exact behaviour you're looking for, but it seems like you just need to bind Ctrl+N? If so:

let g:deoplete#enable_at_startup = 1
let g:deoplete#disable_auto_complete = 1
inoremap <expr> <C-n>  deoplete#manual_complete()

works ok.

like image 59
Rich Churcher Avatar answered Dec 07 '22 04:12

Rich Churcher