7

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?

2 Answers 2

15

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, that was it, I didn't save it with that extension. Thanks.
0

When creating a snippet make sure you escape the $ if needed since the $ sign is used as a pointer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.