Sublime Forum

Custom variables in snippets

#1

In the documentation I found the following sentence.

My Question:
How?

Has anybody any working examples?

I tried some the following. But no substitution occurs.
In global.sublime-settings (in my user folder

// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
    '$YEAR': '2012',
    'sigAuthor': 'Joe Example <joe@example.com>'
}

In a .snippet

<snippet>
    <content><![CDATA[
# $TM_FILENAME
# Copyright (c) $YEAR $sigAuthor

]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>licmit</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
0 Likes

#2

You need to put your custom variables in a tmPreferences file. See this thread for more info:

ST2: Where do I set variables like TM_FULLNAME?

0 Likes