Reputation: 139
Iam looking for an configuration (init.vim) to expand an neosnippet when selected with the deoplete plugin drop down menu.
What i've done so far:
Added all to vim-plug
call plug#begin ('~/.local/share/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets'
call plug#end ()
configured for autostart
" Use deoplete.
let g:deoplete#enable_at_startup = 1
" Use smartcase.
let g:deoplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:deoplete#sources#syntax#min_keyword_length = 2
Now I want to expand this snippet, when hitting <Enter>
at the selection. Has anyone suggestion how to achiev that?
Thanks for your time and best regards,
Befedo
Upvotes: 4
Views: 2435
Reputation: 86
Neosnippets doesn't expand automatically. You need to configure the key mappings. The project suggest the following to expand them using Ctr+k:
" Plugin key-mappings.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
If you want to expand them when using the popup menu use the following:
inoremap <silent><expr><CR> pumvisible() ? deoplete#mappings#close_popup()."\<Plug>(neosnippet_expand_or_jump)" : "\<CR>"
Upvotes: 7