Sublime Forum

ST2: Where do I set variables like TM_FULLNAME?

#1

Sublime Text 2 : Mac

I cannot for the life of me figure out where to set environment variables like TM_FULLNAME for use in Snippets. Can someone point me in the right direction?

Thanks,

D

0 Likes

Custom variables in snippets
Snippets - Context Dependent Variables
New python file comes up empty
#2

Bump :smile:

0 Likes

#3

You need to create your own tmPreferences file and put the definitions there. I use Packages/User/Default.tmPreferences with this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Globals</string>
    <key>scope</key>
    <string></string>
    <key>settings</key>
    <dict>
        <key>shellVariables</key>
        <array>
            <dict>
                <key>name</key>
                <string>TM_FULLNAME</string>
                <key>value</key>
                <string><![CDATA[My Full Name]]></string>
            </dict>
            <dict>
                <key>name</key>
                <string>TM_EMAIL</string>
                <key>value</key>
                <string><![CDATA[My Email]]></string>
            </dict>
            <dict>
                <key>name</key>
                <string>TM_ORGANIZATION_NAME</string>
                <key>value</key>
                <string><![CDATA[My Company]]></string>
            </dict>
            <dict>
                <key>name</key>
                <string>TM_YEAR</string>
                <key>value</key>
                <string><![CDATA[2012]]></string>
            </dict>
        </array>
    </dict>
    <key>uuid</key>
    <string>0ef292cd-943a-4fb0-b43d-65959c5e6b06</string>
</dict>
</plist>
1 Like

#4

Thanks!

Solved my problem!!! >:)

0 Likes

#5

Using the method you suggested, how to get the current time and format it into something like “2014-07-10 12:12”?

Thanks

0 Likes