[TxMt] Re: Escaping in snippets

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Sep 24 09:10:28 UTC 2008


On 24.09.2008, at 10:41, Christoph Wockel wrote:

> $00
>
> where the second 0 should be inserted as text. The wouraround would  
> be $0``0. Unfortunately, I was not able to create an easy where the  
> text flashes on insertion, this only occurs when I use the following  
> Perl script, which I use to move the caret forward on hitting return  
> inside LaTeX inline equations (see the screenshot for the whole  
> bundle editor entry).
>

I do not know if I understood you correctly, but try this one:

#!/usr/bin/env perl
<STDIN>=~/^(.{$ENV{'TM_LINE_INDEX'}}(?:\\?[a-zA-Z]+|.)?)(.*)$/;
$tmp1=$1;
$tmp2=$2;
$tmp1=~s/(\\|\$|`)/\\$1/g;
$tmp2=~s/(\\|\$|`)/\\$1/g;
print "$tmp1\${0:}$tmp2";

To insert a snippet tabstop one normally uses ${x:} ; x := number

--Hans



More information about the textmate mailing list