Reputation: 714
Sorry for the newbie question. I'm using multiple times of the same tag with the same class, for example:
<p class = "paragraph_1"></p>
I'm just wondering how to add this same tag quickly in Sublime Text 2? I know the default tags can be added quickly by just typing a part of them and hit Tab. Is there any similar convenient way for those tags customized by myself?
Thank you very much!
Upvotes: 0
Views: 100
Reputation: 4847
The Sublime Text HTML package inserts snippets into the completion system. If you also want to have your tags, you can just write a snippet for each tag.
To create a snippet:
Preferences
Browse Packages...
User
snippet_name.sublime-snippet
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
<p class="paragraph_1">$0</p>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>par1</tabTrigger>
<description>Tag</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html.basic</scope>
</snippet>
However using SnippetMaker you can easily shorten the process. Just select the content, press ctrl+shift+p
and write SnippetMaker: Make Snippet
.
Additional remarks:
$0
marks cursor position at the end of the snippet.Upvotes: 1