roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Expanding snippert doesn't work #135

Closed osleg closed 7 years ago

osleg commented 7 years ago

In my vimrc I have to expand ultisnip

      let g:UltiSnipsExpandTrigger = '<C-j>'

So I added the mappings as advised on help

imap <expr> <CR>  (pumvisible() ?  "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-j>":"\<CR>")

Tho instead of triggering the snippet I'm getting <Plug>(expand_or_nl) printed out

roxma commented 7 years ago

I'll need your minimal vimrc and reproducing steps to reproduce this issue.

roxma commented 7 years ago

This issue may have useful information: https://github.com/roxma/nvim-completion-manager/issues/89#issuecomment-309207317

osleg commented 7 years ago

I used this as super minimal vimrc

call plug#begin('~/.vim/plugged')

Plug 'roxma/nvim-completion-manager'
Plug 'jmcantrell/vim-virtualenv', has('gui') ? {'for': ['python']} : {}
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

call plug#end()
imap <expr> <CR>  (pumvisible() ?  "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-j>":"\<CR>")
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

let g:UltiSnipsExpandTrigger = '<C-j>'
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'
let g:UltiSnipsListSnippets="<c-s-j>"

And it worked, so I guess the problem is somewhere in the config file, any idea how to debug this except of commenting most of config and adding stuff line by line?

roxma commented 7 years ago

Maybe there's mapping collision on the <CR> key among your plugins.

roxma commented 7 years ago

I'm closing this issue, since this is not NCM issue.

Feel free to continue the discussion.

qazip commented 6 years ago

@osleg , did you find out what was the culprif of <Plug>(expand_or_nl)? I'm having exactly the same problem..

osleg commented 6 years ago

Unfortunately no, I just reverted to using for snippets expansion.