You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
依次找到:Tools -> Developer -> New Snippet,默认代码段配置文件如下:
<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>
配置文件是 XML 格式,含义如下:
snippet: 父节点,必须
content: 内容节点,将要定义的代码段写到该节点下
tabTrigger: 触发节点,设置触发源
scope: 代码段生效作用域
${number:}: Tab 按键切换的光标
下面是一个 Demo:
<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>
接下来 Ctrl + s 保存该文件,写入文件名:hello.sublime-snippet , 然后到文件中通过输入 hello 触发给代码段。
配置文件是 XML 格式,含义如下:
下面是一个 Demo:
接下来
Ctrl + s
保存该文件,写入文件名:hello.sublime-snippet
, 然后到文件中通过输入hello
触发给代码段。注意:最后保存文件的时候,必须是
xxx.sublime-snippet
的名字保存,其中xxx
替换成你自己定义的名字。The text was updated successfully, but these errors were encountered: