Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Sublime text snippet stupid question

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45994
    Eduard
    Member

    Hey guys. I have, maybe a stupid question. Do you know if in Sublime text it is possible to create a snippet with a tab trigger + a variable which will pass in to the actual snippet?

    Something like this:
    Snippet:


    Hello, ${1:} is a snippet.
    ]]>


    hello ${1:}


    And when I will type hello foo, the snippet will output

    Hello, foo is a snippet.

    Without me to have to type anything in the code the snippet will output.

    I just want to have something like tab trigger + var = the code snippet and were it has ${1:} it will be replace automatically with the var in the trigger?

    I know it sounds stupid. I’m just wondering. Thanks a loot.

    #141129
    shaundunne
    Member

    It’s not currently possible to do this, but there are some variables that are available to you to use in a snippet, such as $SELECTION being the text that was selected when the snippet was triggered.

    You can use you own, but I usually find that the default ones are apt.

    You can find full details [here](http://sublimetext.info/docs/en/extensibility/snippets.htmlhttp://sublimetext.info/docs/en/extensibility/snippets.html”).

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.