[TxMt] Re: Move the caret to start of line within a TM snippet? (Charilaos Skiadas)

Charilaos Skiadas skiadas at hanover.edu
Mon Apr 2 04:51:55 UTC 2007


On Apr 2, 2007, at 12:39 AM, Cliff Joyce wrote:

>
>> Just have a macro that moves you to the beginning of the line and  
>> then executes the snippet. Wouldn't that do it? We already do this  
>> trick in the Sweave bundle. Then you can have the macro have  
>> whatever trigger your snippet was going to have.
>
> Thanks, Charilaos (cool idea).  Unfortunately, this won't work well  
> in my situation because the point of the snippet is to assign some  
> HTML text to a PHP variable, like this:
>
Yeah I had misunderstood your question, my suggestion solves a  
different problem.

> The macro would place the caret to the left of the indented $myVar  
> string, then run my snippet (which would not work properly).

Another possible solution is to create a command that takes as input  
the entire current line, and outputs "insert as snippet" printing the  
STDIN as well as doing the rest of the magic you want it to do. You  
might have similar problems with the snippet as well though, and  
hence having to use Allan's suggestion anyway. But you do gain the  
power of a full scripting language.

> Allan's solution looks promising, but I cannot figure out where the  
> place this key in the snippet's plist file:
>
> 	<key>disableOutputAutoIndent</key>
> 	<true/>

I would guess you just forgot to "reload bundles". Direct changes to  
the xml file won't come into effect otherwise, at least I don't think  
so. TM caches the bundle items.

> --Cliff

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list