[TxMt] Inserting Tab Stops inside of Conditional Insertion
Quine
paradoxquine at gmail.com
Wed May 7 08:14:15 UTC 2008
I am trying to make a snippet for easy writing of Effective Uniform Annual
Worth calculations which look something like this: EUAW = (Yearly Benefit +
Salvage Value*[A/F, $5%, $6]) - (Yearly Cost + Initial Cost*[A/P, $10%,
$11]) = [same thing but with [] expressions replaced by table lookups i do
by hand]
This is the snippet I've crafted for this (and to learn how to use
conditionals in snippets in general):
EUAW($1) = (${2:Yearly Benefit}${3: + ${4:Salvage Value}[A/F, $5%, $6]}) -
(${7:Yearly Cost}${8: + ${9:Initial Cost}[A/P, $10%, $11]})
= ${14:($2${4/$|(.+)/(?1: + $1*0.)/}$12) - ($7${9/$|(.+)/(?1: +
$1*0.)/}$13)}
That fills in everything, with appropriate mirroring, with one exception. I
want the text that's inserted if Salvage Value or Initial Cost are not
removed to include a tab stop. Thus I want the last line to look, I think,
like:
= ${14:($2${4/$|(.+)/(?1: + $1*0.${12:Table Lookup Value})/}) -
($7${9/$|(.+)/(?1: + $1*0.${13: Table Lookup Value})/})}
So that way if the salvage value/initial cost fields are removed in the
first part of the equation, the tab stop won't be there, but otherwise it
will so I can fill in the table lookup value. However, I've tried about a
dozen things and I can't get it to put that tab stop there. I understand
that $12 in that context would refer to the regex subexpression 12, but I
have tried escaping all sorts of character combinations to prevent that to
no avail.
If someone could please tell me how to insert those conditional tab stops in
there, I would be most appreciative.
Thanks!
--
View this message in context: http://www.nabble.com/Inserting-Tab-Stops-inside-of-Conditional-Insertion-tp17099738p17099738.html
Sent from the textmate users mailing list archive at Nabble.com.
More information about the textmate
mailing list