Tag and Element shortcuts - Sublime Text 2

只愿长相守 提交于 2019-12-11 01:45:17

问题


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



来源:https://stackoverflow.com/questions/14512373/tag-and-element-shortcuts-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!