I am using neovim with deoplete.nvim and neosnippet.vim. I am trying to make TAB key do both navigating through the popup menu and expand snippets when it's able to. Here is my config.

" <TAB>: completion
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr><Esc> pumvisible() ? "\<C-e>" : "\<Esc>"

I am successfully to make Tab navigating through popup menu but I won't be able to expand the snippet.

For example, when I have function and press Tab. Instead of expand the snippet. It became function<Plug>(neosnippet_expand_or_jump)

Step I went through:

  1. :n test.js
  2. func -> Tab -> select function and press Enter
  3. Press Tab again.
  4. Output function<Plug>(neosnippet_expand_or_jump)

I am not sure what goes wrong here. Please help.

  • Try imap instead of inoremap.
    – VanLaser
    Oct 14, 2016 at 13:48
  • @VanLaser it works, but I don't quite understand. Can you help me explain? Oct 15, 2016 at 1:00
  • Sorry for the late answer, I'm not close to a pc, I hoped someone would link/explain it by now. Try this: stackoverflow.com/questions/31984322/… long story short, with <Plug>, you want recursive mapping, which otherwise you don't want.
    – VanLaser
    Oct 16, 2016 at 0:59

1 Answer 1


The inoremap <expr><TAB> ... also has a <Plug>-mapping on the right-hand side of the mapping. These mappings only get expanded when you use :imap.

So, though you should normally use :noremap, this is one exceptional case where you need to allow recursive mappings.

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.