12

I'm trying to create a new snippet snippet the way that the author of UltiSnips does at 1:28 in this instructional video that he made http://www.youtube.com/watch?v=f_WQxYgK0Pk

How do you put "endsnippets" inside of the snippet without it calling the end of the snippet?

So far I've put the following in ~/.vim/UtliSnips/snippets.snippets

snippet snip "The Snippet Snippet"
snippet ${1:Trigger} "${2:Description}" ${3:Options}
${0}
 endsnippet
endsnippet

This is somewhat of a solution however it creates whitespace at the start of evey "endsnippet" line for every snippet I make. I want to get it right up to the left edge of the screen just like it is in the video. Any suggestions?

pickle323
  • 653
  • 4
  • 12

1 Answers1

14

The answer is actually provided in that same video from 7:50 - 8:17. So all you have to do is the following

snippet snip "The Snippet Snippet"
snippet ${1:Trigger} "${2:Description}" ${3:Options}
${0}
`echo endsnippet`
endsnippet

I actually thought about this before I posted the question, but for some reason I thought that it wouldn't work. Anyway sorry for wasting time, but hopefully this might help someone else with the same problem.

pickle323
  • 653
  • 4
  • 12
  • FWIW any interpolation will work, e.g. `\`!p snip.rv = 'endsnippet'\``, or `\`!v 'endsnippet'\`` achieve the same results. – ZeroKnight Feb 10 '20 at 10:36