在Sublime Text 3中,我试图在一个代码段内插入一个代码段,又名
In Sublime Text 3, I'm trying to insert a snippet inside of a snippet, aka
ul[TAB]产生
<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]渲染
<ul><li>|</li></ul>再次将光标嵌套在元素之间,不幸的是,它成为了崇高文字3中的片段的一部分,[ TAB]将您带到下一个锚点,在这种情况下,退出标签。我发现此功能非常方便,但在这种情况下是PITA。上面列出的击键将呈现:
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?
推荐答案您可以使用 $ 0 来指定光标的位置:
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>我建议您看一下出色的 Emmet 插件,因为它使嵌套HTML标签的支架非常容易。
I recommend taking a look at the excellent Emmet plugin, as it makes scaffolding of nested HTML tags pretty easy.
更多推荐
在另一个代码片段内部时,如何展开一个代码片段?
发布评论