UltiSnips and YouCompleteMe

前端 未结 14 1900
囚心锁ツ
囚心锁ツ 2020-12-07 06:40

I have bundles ultisnips and youcompleteme installed on my macvim. The problem is that ultisnips doesn\'t work because tab is bound by ycm. I tried putting let g:UltiS

14条回答
  •  情书的邮戳
    2020-12-07 07:37

    Although I know this post is a little old, I have my own function that is a little more optimized than the one given above:

    function! g:UltiSnips_Complete()
      call UltiSnips#ExpandSnippetOrJump()
      if g:ulti_expand_or_jump_res == 0
        if pumvisible()
          return "\"
        else
          return "\"
        endif
      endif
    
      return ""
    endfunction
    

    Of course, if you just keep the settings that Joey Liu provided and then just use this function everything will work just perfectly!

    EDIT: Also, I use another function to increase back-stepping functionality between YouCompleteMe and UltiSnips. I'll show you what I mean:

    function! g:UltiSnips_Reverse()                                                                                               
      call UltiSnips#JumpBackwards()                                                                                              
      if g:ulti_jump_backwards_res == 0        
        return "\"                                                                                                           
      endif                                                                                                                       
    
      return ""                                                                                                                   
    endfunction
    

    Then just put this in your .vimrc:

    au BufEnter * exec "inoremap  " . g:UltiSnipsJumpBackwardTrigger . " =g:UltiSnips_Reverse()"
    

    As well as let g:UltiSnipsJumpBackwardTrigger="" and your set!

提交回复
热议问题