Reputation: 123
In Sublime Text 3, I'm trying to insert a snippet inside of a snippet, aka
ul[TAB]
which produces
<ul>|</ul>
with the cursor nested between the elements.
Now, what I'd want to do is be able to expand another snippet inside of this snippet, aka
ul[TAB]li[TAB]
rendering
<ul><li>|</li></ul>
once again with the cursor nested between the elements, unfortunately as part of snippets in sublime text 3, [TAB] brings you to the next anchor point, in this case, exiting the tag. I find this feature incredibly handy, but in this case, a PITA. The above listed keystrokes would render:
<ul>li</ul>|
with the cursor after the closing tag.
Is there a way to exit out of the snippet, so that I can then enter a new snippet?
Upvotes: 3
Views: 581
Reputation: 12882
You can specify the position of the cursor using $0
, example:
<snippet>
<content><![CDATA[
<ul>$0</ul>
]]></content>
<tabTrigger>ul</tabTrigger>
<scope>text.html</scope>
</snippet>
I recommend taking a look at the excellent Emmet plugin, as it makes scaffolding of nested HTML tags pretty easy.
Upvotes: 5