roxma / nvim-completion-manager

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

Ultisnips: Parameter Expansion does not work #142

Closed panders23 closed 6 years ago

panders23 commented 6 years ago

Possible duplicate of #135

With current HEAD when I try to expand a entry with [+] from the popup menu with ultisnips, nothing actually happens. When I try the same config with neosnippet it works without problems.

Below the config I used to reproduce the error: vimrc with ultisnips

source ~/.vim/autoload/plug.vim

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

Plug 'phpactor/phpactor' ,  {'do': 'composer install'}
Plug 'roxma/ncm-phpactor'

autocmd FileType php setlocal omnifunc=phpactor#Complete

Plug 'roxma/nvim-completion-manager'
set shortmess+=c
inoremap <c-c> <ESC>

let g:cm_matcher = {}
let g:cm_matcher.module = 'cm_matchers.abbrev_matcher'
let g:cm_matcher.case = 'smartcase'
let g:cm_completed_snippet_enable = 1
let g:cm_completeopt = 'menuone,noinsert,noselect'

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

Plug 'SirVer/ultisnips'

let g:UltiSnipsExpandTrigger        = "<Plug>(ultisnips_expand)"
let g:UltiSnipsJumpForwardTrigger   = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger  = "<c-k>"
let g:UltiSnipsRemoveSelectModeMappings = 0
" optional
inoremap <silent> <c-u> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>

filetype plugin indent on 
syntax on
call plug#end()

vimrc with neosnippet

source ~/.vim/autoload/plug.vim

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

Plug 'phpactor/phpactor' ,  {'do': 'composer install'}
Plug 'roxma/ncm-phpactor'

autocmd FileType php setlocal omnifunc=phpactor#Complete

Plug 'roxma/nvim-completion-manager'
set shortmess+=c
inoremap <c-c> <ESC>

let g:cm_matcher = {}
let g:cm_matcher.module = 'cm_matchers.abbrev_matcher'
let g:cm_matcher.case = 'smartcase'
let g:cm_completed_snippet_enable = 1
let g:cm_completeopt = 'menuone,noinsert,noselect'

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

Plugin 'Shougo/neosnippet'
Plugin 'Shougo/neosnippet-snippets'
imap <c-j>     <Plug>(neosnippet_expand_or_jump)
vmap <c-j>     <Plug>(neosnippet_expand_or_jump)
inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
vmap <c-u>     <Plug>(neosnippet_expand_target)
" expand parameters
let g:neosnippet#enable_completed_snippet=1

filetype plugin indent on 
syntax on
call plug#end()

I removed the vimscript snippet that automatically downloads vim-plug, because i do that in my dotfile's via a separate sh-script.

roxma commented 6 years ago

Remove let g:cm_completed_snippet_enable = 1. NCM will automatically detect your snippet engine.

If you use non-prefix matcher, NCM will use completefunc to reduce popup flickering, don't use the <c-u> key. See #8 for more information