Hi All,
I'm writing a bundle for gnuplot[1], and I've run into some difficulty with a small snippet I'm trying to write.
What I have so far is this: for [${1:n} ${2:=} ${2/(in)|(.+)/(?1:""::)/}] $0
and what I'd like to have is something more like this: for [${1:n} ${2:=} ${2/(in)|(.+)/(?1:"$3":$3:$4)/}] $0
The conditional expansion seems to work ok, but unfortunately the placeholders inside it don't appear.
Can anyone give me any pointers, or tell me what I'm doing wrong?
Cheers, Matt
[1]: github.com/mattfoster/gnuplot-tmbundle
On 12 Nov 2008, at 10:28, Matt Foster wrote:
[...] and what I'd like to have is something more like this: for [${1:n} ${2:=} ${2/(in)|(.+)/(?1:"$3":$3:$4)/}] $0
The conditional expansion seems to work ok, but unfortunately the placeholders inside it don't appear.
You can’t generate new placeholders via mirrors.
We fake it in a few snippets by having all the placeholders and then use transformations to make it appear as if they are moving.
So something like this:
for [${1:n} ${2:=} ${2/(in)|.+/(?1:")/}$3${2/(in)|.+/(?1:"::)/}$4]
So incase of ‘in’ you get an extra tab stop after ", but otherwise it does what you want. You can probably improve the behavior by rewriting the latter transformation into two transformations, one that inserts the : and the other which inserts the ", then place $4 before the one that inserts ", that way, when the loop uses ‘in’ it’ll have $4 immidiately after $3 (no character inbetween) and TextMate _should_ skip it when you tab away from $3 (making $4 appear invisible).
On Sun, Nov 16, 2008 at 10:53 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 12 Nov 2008, at 10:28, Matt Foster wrote:
[...] and what I'd like to have is something more like this: for [${1:n} ${2:=} ${2/(in)|(.+)/(?1:"$3":$3:$4)/}] $0
The conditional expansion seems to work ok, but unfortunately the placeholders inside it don't appear.
You can't generate new placeholders via mirrors.
We fake it in a few snippets by having all the placeholders and then use transformations to make it appear as if they are moving.
So something like this:
for [${1:n} ${2:=} ${2/(in)|.+/(?1:")/}$3${2/(in)|.+/(?1:"::)/}$4]
So incase of 'in' you get an extra tab stop after ", but otherwise it does what you want. You can probably improve the behavior by rewriting the latter transformation into two transformations, one that inserts the : and the other which inserts the ", then place $4 before the one that inserts ", that way, when the loop uses 'in' it'll have $4 immidiately after $3 (no character inbetween) and TextMate _should_ skip it when you tab away from $3 (making $4 appear invisible).
That's excellent, thanks.