Thursday, August 30, 2012

Different behavior expanding snippet directly or through inoremap

Hi, I use the snippet plugin ultisnips.
Assume I have two snippets:
snippet snip1 "snippet1" !w
( $1 - $2 )$0
endsnippet

snippet snip2 "snippet2" !w
[ $1 - $2 ]$0
endsnippet

I use <c-j> to expand the snippets and move forward to the next placeholder:
inoremap <NL> <c-r>=UltiSnips_ExpandSnippetOrJump()<CR>

I also use the imaps
inoremap `1 snip1<C-R>=UltiSnips_ExpandSnippetOrJump()<CR>
inoremap `2 snip2<C-R>=UltiSnips_ExpandSnippetOrJump()<CR>

If I type snip1 then expand with <c-j> and this inside type snip2 and expand again, I can type <c-j> sucessuvely until I jump out the inner snippet and then the outer snippet.
On the other hand if I use `1 to expand the snippet and then inside the first snippet type `2 and expand the second snippet I can type <c-j> to navigate outside the inner snippet but not outside the outer snippet.

This is strange because in my mind the imap should translate to what I type directly.

I already asked the author of the snippet plugin and he has no idea why this happens...

Does anyone have any idea?

Thank you,

Jorge

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment