Maison  >  Article  >  outils de développement  >  Comment écrire un extrait sublime

Comment écrire un extrait sublime

藏色散人
藏色散人avant
2021-07-05 16:21:192421parcourir

下面由sublime教程栏目给大家介绍sublime Snippet如何编写!

Comment écrire un extrait sublime

sublime Snippet编写

    <snippet>
        <content></content>
        <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
        <!-- <tabTrigger>hello</tabTrigger> -->
        <tabtrigger>hello</tabtrigger>
        <!-- Optional: Set a scope to limit where the snippet will trigger -->
        <!-- <scope>source.python</scope> -->
        <scope>text.html</scope>
        <description>Hellossssssssssssssssssssssssssssssssssssssss My test.</description>
    </snippet>

snippet是片段的意思,就是说智能提示的概念。

content是片段内容,scope标签是触发的文件类型,tagTrigger是触发的关键字,description是注释说明

他和macro的区别是:
宏的操作都是需要用快捷键的,而且保存的宏必须加载在系统keymap文件user自定义部分当中。
eg:

对已经保存的宏的操作:

[      { "keys": ["ctrl+shift+;"], "command": "run_macro_file", "args": {"file": "res://Packages/User/test.sublime-macro"} }  ]
 而snippet操作是用于只能提示,只要文件保存了系统就会自动加载,不需要keymap。

但是,marco是对多个操作的统一规划,而snippet只是只能提示罢了。
也就是说当你需要一堆有顺序的按键操作的时候,使用marco,记录宏实际上就是记录你的按键顺序。
而当你想加载一个模板或者智能提示时,用snippet

效果如图所示

Comment écrire un extrait sublime

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Cet article est reproduit dans:. en cas de violation, veuillez contacter admin@php.cn Supprimer