Sublime Text 2代码段

jb1*_*785 7 sublimetext

我昨天刚开始使用Sublime Text 2,我很喜欢它.但是,我正在尝试设置一个我会一直使用的代码片段.问题是编辑根本没有认识到它.我把它保存在我的Packages/User文件夹中.该片段如下:

<snippet>
    <content><![CDATA[echo "<pre>".print_r(${0:var},true)."</pre>";]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>pre</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
    <description>print r with pre tags</description>
</snippet>
Run Code Online (Sandbox Code Playgroud)

知道我做错了什么吗?

Bou*_*ode 15

确保使用.sublime-snippet扩展名保存.只有当范围是php时,您的代码段才会展开.所以它必须在php标签中,即使它是在php文件中.