Sublime Forum

Snippet swap words

#1

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

0 Likes

#2

“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.

<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>

0 Likes

#3

thank you. it was not exactly what i looked for, but it is a nice way to do it.

0 Likes