SirVer / ultisnips

UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
GNU General Public License v3.0
7.54k stars 692 forks source link

Ultisnips not working with YouCompleteMe Help Needed #1278

Open harsh-singh-rathore opened 4 years ago

harsh-singh-rathore commented 4 years ago

Expected behavior: I have YouCompleteMe installed so I used ctrl+p for snippet trigger but maybe instead of ctrl+p becomming the trigger this statement maps tab which also maps youcompleteme trigger. When tab trigger is pressed (in this case ctrl+p )the snippet should complete to whatever the snippet is, for example, cl should expand to a class snippet for python.

Actual behavior: Now when I press c-p it just toggles between some options and when I try to select any of those by pressing the enter key the snippet trigger name is written and the cursor moves to the next line and pressing ctrl+p just toggles between lines produces nothing.

Steps to reproduce

let g:UltiSnipsExpandTrigger="<C-p>"
let g:UltiSnipsJumpForwardTrigger="<C-b>"
let g:UltiSnipsJumpBackwardTrigger="<C-z>"
let g:UltiSnipsEditSplit="vertical"

this is my configuration I used c-p as the trigger because I use YouCompleteMe also and the installation guide said to change the trigger to something else if you used it.

Thanks in advance.

  1. In a .py extension file write cl
  2. clicking tab trigger in this case ctrl+p
  3. toggles between some options and does not produce the reqd output

chumbucket commented 4 years ago

Try changing your expand trigger to control-b.

teleprint-me commented 3 years ago

I have the same issue

Try changing your expand trigger to control-b.

@chumbucket This does not work... I have the following in my .vimrc

let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"

This actually fails and does not expand when I hit tab.

If I replace <tab> with <return>, then it remaps <return> and i can no longer use it as expected during insert mode; which is when Ultisnips is active and usable.

let g:UltiSnipsExpandTrigger="<return>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"

If I use mode inoremap to avoid remapping and to enable it during insert mode, it still fails, and there is no visible change or effect.

let g:UltiSnipsExpandTrigger="inoremap <tab> <return>"
let g:UltiSnipsJumpForwardTrigger="inoremap <tab> <tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"

The expected format is

map-command map-argument {LHS} {RHS}

If I simply try to remap the key for insert mode using only {LHS} and ommitting map-argument and {RHS}, I still get the same result.

let g:UltiSnipsExpandTrigger="inoremap <return>"
let g:UltiSnipsJumpForwardTrigger="inoremap <tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"
teleprint-me commented 3 years ago

I'm using this configuration which seems to be working as a temporary work around. Though, an actual fix, or explanation on how this works, would be much appreciated.

let g:UltiSnipsExpandTrigger="<c-a>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<shift><tab>"
let g:UltiSnipsEditSplit="vertical"