美文网首页
Sublime Text Code Snippets

Sublime Text Code Snippets

作者: 卖梦想的男孩 | 来源:发表于2016-11-22 13:56 被阅读26次

sublime-code-snippets支持更为自由的自定义代码块
只需要输入模板+Tab就可以搞定

  • 书写 Tools->Developer->New Snippet
    默认模板
    • content为模板区域 ${1:}为Tab后的光标切换位置
    • tabTrigger 触发模板的关键字
    • scope为使用模板的范围 source.xxx (文件类型)
<snippet>
    <content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
     <tabTrigger>hello</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
  • 保存在user下xxx.sublime-snippet
  • 使用snippet
    新建一个文件输入hello,然后Tab出现模板,再按Tab光标切换

相关文章

网友评论

      本文标题:Sublime Text Code Snippets

      本文链接:https://www.haomeiwen.com/subject/avippttx.html