0

I'm using tabnine and COC.

I have a ~/.vimrc with the following lines:

inoremap <expr> <C-j> pumvisible() ? "\<C-N>" : "j"                                                                                                       
inoremap <expr> <C-k> pumvisible() ? "\<C-P>" : "k" 

and they let me use CTRL+j/k to navigate the suggestions.

I saw that clicking the right arrow "chooses" the suggestion by tabnine, but couldn't bind it to anything (enter, space, etc.)

How to I do thatim

1 Answer 1

2

You can check :h :coc-completion for a mapping suggestion.

It goes like so:

inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>"

In popupmenu, <c-y> (ctrl-y), accepts the suggestion (see :h :popupmenu-keys).

I like ctrl-space better, and I want it to show the menu if it's not displayed yet, so I do:

inoremap <expr> <c-space> pumvisible() ? coc#_select_confirm() : coc#refresh()

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.