1

I wrote that little snippet to help my workflow in Sublime Text 3:

<snippet>
    <content><![CDATA[
    (function ($) {"use strict";$(function () {$1});}(jQuery));
]]></content>
    Optional: Tab trigger to activate the snippet
    <tabTrigger>self.function</tabTrigger>
    <!-- Optional: Scope the tab trigger will be active in -->
    <scope>source.js</scope>
    <!-- Optional: Description to show in the menu -->
    <description>self.trigger.function</description>
</snippet>

The contextual menu display is when I start to type "self" in a javascript file, but when I hit "Enter", nothing is pasted to my file.

Any idea why that is?

Thanks

1 Answer 1

2

You need to escape $ if you want that character to appear literally. Or else SublimeText would assume it to be a Variable field. So just do this -

(function (\$) {"use strict";\$(function () {$1});}(jQuery));

Now it'll work. Details are under the content section of the documentation.

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

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.