Home Download Buy Blog Forum Support

multiple tabTrigger tags in a snippet

multiple tabTrigger tags in a snippet

Postby dknell on Sun Mar 06, 2011 6:30 pm

I am creating some snippets and I want a few to have multiple tabTriggers. For example, in the following code, I'd like snippet to trigger on create[TAB] and button[TAB]. Is this possible, or is there a better way to do this?

Code: Select all
<snippet>
   <content><![CDATA[var ${1:button} = Ti.UI.createButton(${2:\{
   ${3:title:"${4:my button}"}
\}});]]></content>
   <tabTrigger>create,button</tabTrigger>
   <scope>source.js</scope>
   <description>Ti.UI.createButton()</description>
</snippet>
dknell
 
Posts: 1
Joined: Sun Mar 06, 2011 6:22 pm

Re: multiple tabTrigger tags in a snippet

Postby jps on Sun Mar 06, 2011 11:06 pm

This isn't supported: you'd have to have two snippets with different tab triggers but the same contents
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: multiple tabTrigger tags in a snippet

Postby trashman on Sun Oct 09, 2011 7:54 pm

+1

Would be great to have this, if only to be able to trigger snippet for any part of word. In other words, s sw swi swit switc switch would all trigger a switch () {} snippet on tab (or show options if there are other matches).
trashman
 
Posts: 1
Joined: Sun Oct 09, 2011 7:52 pm

Re: multiple tabTrigger tags in a snippet

Postby iamntz on Mon Oct 10, 2011 3:40 am

Did you tried sublime-completion file?
Here is how i did it for css: https://gist.github.com/1274586

notice things like this:
Code: Select all
{ "trigger": "d|dis|display", "contents": "display:${1:block}${2:none}${3:inline-block};$0" },



It's also an easy way to maintain a large number of snippets for the same language/scope :D
iamntz
 
Posts: 898
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania


Return to Technical Support

Who is online

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