I am using UltiSnippets

let g:UltiSnipsExpandTrigger='<None>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<S-b>'
let g:coc_snippet_next = '<tab>'
let g:coc_snippet_prev = '<S-tab>'

And also nvim-coc

"select from menu by Tab
 inoremap <silent><expr> <TAB>
       \ pumvisible() ? "\<C-n>" :
     \ <SID>check_back_space() ? "\<TAB>" :
       \ coc#rpc#request('doKeymap', 'snippets-expand')

 function! s:check_back_space() abort
let col = col('.') - 1
   return !col || getline('.')[col - 1]  =~# '\s'

And with tab i can select a item from menu, but when i press Enter to expand snippet or lsp, popup disapear, and expand don't work.

enter image description here

How can i fix this behavior?

I really like to use tab for navigation throw menu items. And desactivated UltiSnippets tab expander for this.

Thanks in advance for answer.


1 Answer 1


See :help popup-menu-keys assuming these plugins are using :help ins-completion-menu.

You could probably setup a conditional mapping like

:inoremap <expr> <cr> pumvisible() ? '<c-y>' : '<cr>'

and you could use <c-y><cr> instead of just <c-y> if you wanted the Enter press to accept and insert a newline.

  • Thanks it work like i want.
    – serii
    Commented May 16, 2022 at 16:42
  • @serii Generally we use upvotes or accepted answers for that indicator (see the help center sections on the relevant topics)
    – D. Ben Knoble
    Commented May 16, 2022 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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