Home Download Buy Blog Forum Support

custom variables in snippets

custom variables in snippets

Postby kyrios on Mon Mar 05, 2012 11:36 am

In the documentation I found the following sentence.
You can also add your own variables to provide extra information. These custom variables are defined in .sublime-options files.

My Question:

Has anybody any working examples?

I tried some the following. But no substitution occurs.
In global.sublime-settings (in my user folder
Code: Select all
// 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
Code: Select all
# Copyright (c) $YEAR $sigAuthor

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

Posts: 1
Joined: Mon Mar 05, 2012 11:31 am

Re: custom variables in snippets

Postby svenax on Mon Mar 05, 2012 12:34 pm

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?
Posts: 169
Joined: Tue Dec 20, 2011 12:47 pm

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 23 guests