Home Download Buy Blog Forum Support

snippet swap words

snippet swap words

Postby saftmixer on Wed Apr 10, 2013 3:40 pm

hey there,

i often write my own snippets and now i have a little question.
i want to tab through the fields and for some fields i want to have more than one default value, so that i can swap between them.
e.g. "excercise for (physics/biologie)" is there a way to do that?

saftmixer
saftmixer
 
Posts: 3
Joined: Wed Apr 10, 2013 3:34 pm

Re: snippet swap words

Postby agibsonsw on Wed Apr 10, 2013 10:43 pm

"more than one default" is a contradiction(?). The following is probably not exactly what you were hoping for, but if you type 'p' it will insert 'physics', 'b' will insert 'biology' - then tab out.

Code: Select all
<snippet>
    <content><![CDATA[
exercise for (${1:physics/biology}${1/(p$)|(b$)|.*/?1:hysics:?2:iology/i})$0
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>hello</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: snippet swap words

Postby saftmixer on Fri Apr 12, 2013 9:31 am

thank you. it was not exactly what i looked for, but it is a nice way to do it.
saftmixer
 
Posts: 3
Joined: Wed Apr 10, 2013 3:34 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 27 guests