• Sublime Text3 008 Snippet 自定义 代码片断


    Sublime Text3 008 Snippet 自定义 代码片断
    ------------------------------------------------------------------------------
    如果有什么不明白的,加QQ群:186970878

    经常会有错字 或 语句不通的,欢迎联系本人,方便快速修正,也方便后来者阅读。

    联系本人QQ: 2071551682
    ------------------------------------------------------------------------------
    --------------------------- 自定义代码片断 ----------------------

    1. 新建模板

    Meun  Tools -> developer -> New Snippet...
    菜单  工具  -> 插件开发  -> 新建代码片断...

    ---------------------------------------------------------------------------------

    2.  模板保存

    Ctrl+s 保存。名字随便起,但是后缀名必须是.sublime-snippet

    这里命名:html5.sublime-snippet

    默认保存位置:

    C:UsersAdministratorAppDataRoamingSublime Text 3PackagesUser

    ---------------------------------------------------------------------------------

    3.  修改模板

    在<![CDATA[和]]>内写下你要的代码片段,注意的是代码片段要靠最左边。

    <snippet>
     <content><![CDATA[
      <!DOCTYPE html>
      <html>
       <head>
        <meta charset="UTF-8">
        <title>Document
        </title>
       </head>
       <body>

       </body>
       </html>
    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>

    ---------------------------------------------------------------------------------

    4.  设置快捷键

    把下面tabTrigger标签的注释打开,中间的 hello 改成 h 就是你的快捷键。

    ]]></content>
     <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
     <tabTrigger>h</tabTrigger>
     <!-- Optional: Set a scope to limit where the snippet will trigger -->

     <!-- Optional: Set a scope to limit where the snippet will trigger
     设置范围以限制片段将触发的位置 -->
     <!-- <scope>source.python</scope> -->
    </snippet>


    ---------------------------------------------------------------------------------

    5.  使用保存的模板

    快捷键调用模板

    h + TAB(tab)

    菜单 调用 模板(代码片断)

    Meun  Tools -> Snippets
    菜单  工具  -> 代码片断 ...

    ---------------------------------------------------------------------------------

    保存的文件代码:

    <snippet>
     <content><![CDATA[
    <!DOCTYPE html>
    <html>
     <head>
      <meta charset="UTF-8">
      <title>${1:杜鱼的 希望课堂}
      </title>
     </head>
     <body>
    Hello,${2:主体内容}
     </body>
    </html>
    <!-- Hello, ${1:this} is a ${2:snippet}. -->
    ]]></content>
     <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
     <tabTrigger>h</tabTrigger>
     <!-- Optional: Set a scope to limit where the snippet will trigger -->
     <!-- <scope>source.python</scope> -->
     
    </snippet>

    ---------------------------------------------------------------------------------

    5.新建一个页面index.html,在 index 中输入一个h,然后按Tab键,就出现你设置的代码片段了。


    代码插入了进来后,并且此时的光标停留在我们所标记的${1}位置处,

    如果我们再按下Tab,那么光标就跳转到${2}的位置。

    ---------------------------------------------------------------------------------

    ------------------------------------------------------------------------------
    如果有什么不明白的,加QQ群:186970878

    经常会有错字 或 语句不通的,欢迎联系本人,方便快速修正,也方便后来者阅读。

    联系本人QQ: 2071551682
    ------------------------------------------------------------------------------

  • 相关阅读:
    Tomcat 性能监控与调优
    04 使用 BTrace 进行拦截调试
    03 JVisualVM(本地和远程可视化监控)
    02 jmap+MAT(内存溢出)、jstack(线程、死循环、死锁)
    01 JVM的参数类型、jinfo & jps(参数和进程查看)、jstat(类加载、垃圾收集、JIT 编译)
    69_缓存预热解决方案:基于storm实时热点统计的分布式并行缓存预热
    66_讲给Java工程师的史上最通俗易懂Storm教程:纯手工集群部署
    57_分布式缓存重建并发冲突问题以及zookeeper分布式锁解决方案
    54_基于nginx+lua+java完成多级缓存架构的核心业务逻辑
    53_部署分发层nginx以及基于lua完成基于商品id的定向流量分发策略
  • 原文地址:https://www.cnblogs.com/qy123/p/9190798.html
Copyright © 2020-2023  润新知