2

I am using the setup I found in this answer: UltiSnips and YouCompleteMe

namely:

" if you use Vundle, load plugins:
Bundle 'ervandew/supertab'
Bundle 'Valloric/YouCompleteMe'
Bundle 'SirVer/ultisnips'

" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'

" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"

I am working on a tex document, and trying to insert the snippet in the screenshot. Pressing tab, or ctrl-n will cycle me through the options presented, but I can't for the life of me insert the snippet. Pressing enter, space of just continuing with { just behaves as if I were typing (which I guess is what is to be expected, but I had no better idea).

What do I need to do to insert the snippet shown there?

enter image description here

6
  • What about changing forward trigger and backward trigger to <c-j> and <c-k>? I am using deoplete and have no problem in inserting snippets.
    – jdhao
    Commented Jan 9, 2020 at 15:28
  • Use other expansion trigger
    – eyal karni
    Commented Jan 9, 2020 at 16:09
  • Does <C-Y> work if you have the snippet highlighted?
    – filbranden
    Commented Jan 9, 2020 at 17:36
  • @jdhao changing the above to let g:UltiSnipsJumpForwardTrigger = "<c-j>" doesn't do anything, I press ctrl-j and nothing happens.
    – fbence
    Commented Jan 9, 2020 at 19:48
  • @filbranden Unfortunately, no.
    – fbence
    Commented Jan 9, 2020 at 19:49

1 Answer 1

0

Code:

let g:UltiSnipsExpandTrigger = '<c-g>'
    "strange that I have to change this
    let g:SuperTabMappingForward = '<s-tab>'
    let g:SuperTabMappingBackward = '<tab>'

go to the snip option in the menu, and press ctrl-g.

Originally, it supposed to be tab, what expands. But supertab has taken control over tab.

3
  • This doesn't work either. I think I will need to disable all other plugins and figure out what is going on ...
    – fbence
    Commented Jan 10, 2020 at 9:58
  • You can check my vimrc. I have a similar configuration github.com/eyalk5/.vim
    – eyal karni
    Commented Jan 10, 2020 at 11:35
  • I copied the relevant part
    – eyal karni
    Commented Jan 10, 2020 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.