roxma / nvim-completion-manager

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

Show pop-up menu and trigger completion (Ultisnips + NCM) #164

Open filipekiss opened 6 years ago

filipekiss commented 6 years ago

So I've followed the instructions here to setup C-U to trigger the completion menu or expand the UltiSnips trigger.

Most of the time it works as expected, but there's something I don't know how to solve: pressing C-U to trigger the pop-up in the middle of the line yields no results, but if I do it at the beginning of the line it works perfectly.

Here's a demo of the problem:

2017-11-29 12 23 29

Here's my NCM/UltiSnips config:

let g:UltiSnipsExpandTrigger        = "<Plug>(ultisnips_expand)"
let g:UltiSnipsJumpForwardTrigger   = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger  = "<c-k>"
let g:UltiSnipsRemoveSelectModeMappings = 0
inoremap <silent> <c-u> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>
inoremap <expr> <c-j> pumvisible() ? "\<C-n>" : "\<c-j>"
inoremap <expr> <c-k> pumvisible() ? "\<C-p>" : "\<c-k>"
xmap <c-u> <Plug>(ultisnips_expand)
smap <c-u> <Plug>(ultisnips_expand)

let g:cm_complete_delay = 0
let g:cm_sources_override = {
        \ 'cm-tags': {'enable':0}
        \ }

let g:UltiSnipsSnippetsDir='~/.dotfiles/config/vim/.vim/ultisnips'
let g:UltiSnipsSnippetDirectories=['ultisnips']
let g:UltiSnipsEditSplit='context'

What am I doing wrong?

Thanks!

seb-mueller commented 6 years ago

Just as a hunch, it might have to do with the snippet option itself (see here or :h UltiSnips-snippet-options). Am Ultisnip snippet can be configured to only expand at the beginning of a line, maybe you have the b option set?

filipekiss commented 6 years ago

@seb-mueller Not really. My :aut snippet, for example, can be expanded anywhere on the line and doesn't show up if there's a space and I invoke C-u. After I type a few letters the completion menu will pop-up, no problem, but if I trigger it manually it only works at the beginning of the line.