Sublime自定义语法

时间:2024-01-10 22:10:08

以thinkphp框架的assign函数为例

在sublime\Data\Packages\PHP下

新建文件:assign.sublime-snippet

内容为

<snippet>
<content><![CDATA[\$this->assign('${1:}',\$${1:});]]></content>
<tabTrigger>assign</tabTrigger>
<scope>source.php</scope>
<description>assign</description>
</snippet>

下面两个是打印测试自动加断点的:

1.新建文件:var.sublime-snippet

内容为

<snippet>
<content><![CDATA[
var_dump(\$${1:res});exit;
]]></content>
<tabTrigger>var</tabTrigger>
<scope>source.php</scope>
<description>var</description>
</snippet>

2.新建文件:pre.sublime-snippet

内容为

<snippet>
<content><![CDATA[
echo "<pre>";
print_r(\$${1:rs});
exit;
]]></content>
<tabTrigger>pre</tabTrigger>
<scope>source.php</scope>
<description>pre</description>
</snippet>