+2

snippet to create a snippet

Jonathan King il y a 13 ans 0
This is an idea straight from the top of my head, but the tools->New Snippet, to me, seems to defeat the purpose of the power of the snippet. Why not create a function that when you create a new snippet, you can tab through the new snippet like a regular one?

I threw this together as my first one (I'm new to sublime text, I'm still dealing with an escaping issue, but you get the just of my idea)

<snippet>
     <content>

<![CDATA[
<snippet>
    <content>
         <![CDATA[${1:Enter your snippet here}]]${2:>}
    </content>
         <!-- Optional: Tab to trigger to activate the snippet -->
              <tabTrigger>${3:Enter your trigger here}</tabTrigger>

         <!-- Optional: Scope the tab trigger will be active in -->
              <scope>${4:Enter Scope Here}</scope>

         <!-- Optional: Description to show in menu -->
              <description>${5:Enter your Snippet Description Here}</description>

</snippet>
]]>
     </content>

    <!-- Optional: Tab trigger to activate the snippet -->
    <tabTrigger>snippet</tabTrigger>
    <!-- Optional: Enter the scope the tag trigger will be active in -->
    <scope>text.xml</scope>

    <!-- Optional: Description to show in the menu -->
    <description>Auto-Snippet</description>

</snippet>