标签和元素快捷键 - Sublime Text 2 [英] Tag and Element shortcuts - Sublime Text 2

查看:34
本文介绍了标签和元素快捷键 - Sublime Text 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为标签创建自己的快捷方式,就像我输入li"一样,它会自动输入 li type="square" 而我只需按 Enter 键?

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?

推荐答案

您是否尝试过制作自己的片段?

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>

如果您输入 li 然后按 Tab,这将在当前文件中输入一个

  • 标签.您还可以添加 标记以将其限制为 HTML 文件.

    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.

    来自非官方文档:

    代码片段可以存储在任何包的文件夹下,但为了在您学习时保持简单,您可以将它们保存到您的包/用户文件夹

    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

    这篇关于标签和元素快捷键 - Sublime Text 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆