Youcompleteme: Can't get Ultisnippets to work together with YCM.

Created on 12 May 2013  路  5Comments  路  Source: ycm-core/YouCompleteMe

I've also tried JazzCore hack:
https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411

But It still doesn't work, it shows the snippet's keyword and definition but it doesn't insert the snippet, nor with tab, nor with s-tab, nor with c-tab.

Here's my vimrc: https://github.com/Bercio/Dotfiles/blob/master/vimrc

Most helpful comment

In your .vimrc:

let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"

Then use ctrl-j for completions.

All 5 comments

As i've pointed in #36, keep in mind that you set autocmd on BufEnter. So the key will be remapped only when you switch buffer or open new file, not directly after vim startup. Have you switched buffers?

If it's still dont work for you, post output of let g:UltiSnipsExpandTrigger command. If it's not Tab, try adding a let g:UltiSnipsExpandTrigger='<Tab>' before completion function definition.

You need to change the UltiSnips expansion trigger to something other than TAB. Then you insert the snippet "trigger" string with YCM and then you invoke the expansion key.

I'm having the same problem, and I read #36 but I'm lost.
Is there a clear explanation of what to do to get it working?

In your .vimrc:

let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"

Then use ctrl-j for completions.

The information in previous discussions is spread across many comments. The following works for me, as posted before by others (@JazzCore etc). Put this in your vimrc and keep in mind that it only works after you open a new buffer (so don't launch vim right into a file and expect it to work).

" Complete UltiSnip snippets with <tab>
function! g:UltiSnips_Complete()
    call UltiSnips_ExpandSnippet()
    if g:ulti_expand_res == 0
        if pumvisible()
            return "\<C-n>"
        else
            call UltiSnips_JumpForwards()
            if g:ulti_jump_forwards_res == 0
               return "\<TAB>"
            endif
        endif
    endif
    return ""
endfunction

au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

pprzetacznik picture pprzetacznik  路  4Comments

blackode picture blackode  路  3Comments

f-koehler picture f-koehler  路  5Comments

tgzhou98 picture tgzhou98  路  3Comments