Since I'm not facing a bug, I do not need to provide an init.vim and scenarios to reproduce it.
What I'm searching for is further integration with snippets. So far, I understand that neosnippet expands its snippet on TAB, and Deoplete.nvim makes it possible to cycle through all the suggestions with TAB. It places the selection directly into the file that is being edited.
Is it possible to trigger the expand of Neosnippet or any other snippet tool when the suggestion is selected in the menu? If so, can someone explain to me where I need to look?
" SuperTab like snippets' behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
This does not expand a snippet upon selection.
Init.vim
call plug#begin('~/.config/nvim/plugged')
Plug 'Shougo/dein.vim' " dein itself
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neosnippet.vim' " Snippets
Plug 'Shougo/neosnippet-snippets'
call plug#end()
let g:deoplete#enable_at_startup = 1
imap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
To reproduce:
Please use here.
imap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ \ pumvisible() ? "\<C-n>" : "\<TAB>"
Thanks for all the help so far man!
There was a \ to much but this works:
imap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ pumvisible() ? "\<C-n>" : "\<TAB>"
The behavior is a bit different from what I'd expect, the expand gets triggered when i use tab and the whole snippet shortcut is typed. I can still use <C-n> instead of <TAB> to navigate between the options, then select the snippet which I want to expand, but wouldn't it be easier if i can cycle through expanded snippets? Normally it places the suggestion on selection, but not an expanded snippet. Is this possible?
Unfortunately, it is not possible.
It is Vim's feature.
Ok, thank you for your support! I really appreciate it.
Most helpful comment
Unfortunately, it is not possible.
It is Vim's feature.