Hello,
Using this minimal vim, the backward trigger doesn't go back.
set nocompatible
filetype indent on
call plug#begin('~/.vim/plugged')
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
call plug#end()
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<c-z>"
The problem isn't the keystrokes, because if I change it with forward it works.
Vim version: 7.4-1-778
URXvt: 9.21
How can I give more information?
I cannot reproduce this with my setup. According to the plug readme you can drop the first two lines in your vimrc - does that make a difference?
Which snippet are you testing with?
Which snippet are you testing with?
Now I got the "problem".
When using a snipmate snippet, it doesn't go back. This is supposed to work?
e.g. snippet if in a c file.
so you are using this snippet? https://github.com/honza/vim-snippets/blob/master/snippets/c.snippets#L54
if so, that is working as intended: as soon as you reach the $0 tabstop, you can no longer jump back: the snippet is exited.
this is a performance optimization: if you would just continue to type in $0 and the snippet would still be active, UltiSnips would continue to diff your buffer on every keystroke you type - rather performance intensive.
Closing for now - please speak up if you still see a bug.
So why this snippet works? Seems to be the same case.
https://github.com/honza/vim-snippets/blob/master/UltiSnips/php.snippets#L64.
If I don't use snipmate snippets, I can always go back.
No, it is not the same case. The snippet you link contains $1 and $2 - if you jump one more (to the end of the snippet, the implicit $0) it will also exit and you can no longer go back.
The same logic is used for UltiSnips snippets too - so no, you cannot go back when you use ultisnips snippets once you hit $0.
The code isn't the same, but the logic is conflicting with what you said.
Why is the c snippet a performance optimization and the php not?
Why the php snippet doesn't follow the idea of the c snippet (don't go back to condition)?
What make they different?
the php snippet is just wrong - it should follow the idea of the c snippet.
Go ahead and try it yourself: Copy a long text (like a web page), then insert the c snippet till you reach $0 and paste -> you can insert.
do the same for the php one -> Vim will take 100% and likely hang forever.
Thank you for the explanation.
I don't know how long is a long text for _me_, but I think it's more likely that _I_ want to go back than writing or pasting a long text. Maybe I'll create an issue to honza, for consistency in the snippets.