Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 code snippet

Tags:

sublimetext

I just started using Sublime Text 2 yesterday and I'm liking it a lot. However, I am trying to set up a code snippet that I would use all the time. The problem is that the editor isn't recognizing it at all. I saved it in my Packages/User folder. The snippet is below:

<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>

Any idea what I'm doing wrong?

like image 635
jb1785 Avatar asked Feb 29 '12 13:02

jb1785


1 Answers

Make sure it is saved with a .sublime-snippet extension. Your snippet will only expand when the scope is php. So it has to be in php tags even if it's in a php file.

like image 192
Liam Cain Avatar answered Sep 24 '22 22:09

Liam Cain