Tag and Element shortcuts - Sublime Text 2

2019-07-17 06:54发布

问题:

Is there a way you can make your own shortcuts for your tags, like if I type in "li" It will automatically put in li type="square" and all I have to do is hit enter?

回答1:

Have you tried to make your own snippets?

Try the New Snippet command in the Tools-menu and add the following and save it:

<snippet>
    <content><![CDATA[
<li type="square">${1:Item} ${2:}
]]></content>
    <tabTrigger>li</tabTrigger>
</snippet>

This will enter an <li>-tag in the current file if you type li and then press Tab. You can also add a <scope> tag to limit it to HTML-files.

From the unofficial documentation:

Snippets can be stored under any package’s folder, but to keep it simple while you’re learning, you can save them to your Packages/User folder