Thanks for your suggestions guys, the Macros seemed to work but it has the same behavior as if it is used inside a para (it brakes the sentences in the middle).<br><br>Let me back up a little, the item I am using this for is ActionScript (Flash) and there is a function within actionscript that is called Trace, similar to echo or print but for debugging purposes.
<br><br>So if I am writing my application by hand I would do something like this<br><br>var i:Number = 10;<br>trace (" Var i = " i);<br><br>So I am trying to find a way to do it where i can just select a part of a sentence (in this case a variable) and have the result back when I need it instead of typing it by hand.
<br><br>but in this case the Macros still does something like this:<br><br>var i<br>trace("i =e + ir = 10;<br><br>the snippet(which you guys figured out its not a good idea does the following:<br><br>var trace("i = " i);:Number = 10;
<br><br>So anyways, I was thinking of doing something like this:<br><br>1. type the code -- var:i:Number = 10;<br>2. type the item I need to "trace" (in this case -i- by itself)<br>3. run macros or snipped and it shoudl work.
<br><br>I still would have to take an extra step but saves a little bit of typing.<br><br><br><br><br><div><span class="gmail_quote">On 1/24/07, <b class="gmail_sendername">Charilaos Skiadas</b> <<a href="mailto:skiadas@hanover.edu">
skiadas@hanover.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>On Jan 24, 2007, at 12:08 PM, Charilaos Skiadas wrote:
<br><br>> On Jan 24, 2007, at 11:48 AM, Helmut Granda wrote:<br>>> and this works great if there is only one line of text but lets<br>>> say I need to select a certain word in the middle of a pharragraph<br>
>> then i get the following<br>>><br>>> before snippet:<br>>> first word theText second word<br>>><br>>> after snippet:<br>>> first word theText theText = theText second word<br>>>
<br>>> as you can tell the snippet inserts the comman din the middle of<br>>> the sentence, is there a way to avoid that?<br>><br>> You would need to use a command, that has as input the entire<br>> document and output probably insert as snippet. Then you would have
<br>> to locate the line the caret is at, and then add a line right after<br>> it with what you want. You then need to snippet-escape all the<br>> regular text, and add a $0 at the correct location where you want
<br>> the caret to end up.<br>><br>> Sorry, short on time here, but there are ruby libraries that make<br>> most of the above very easy (for instance the escaping part). The<br>> location can be found via the [dynamic environment variables]
<br>> [<a href="http://macromates.com/textmate/manual/">http://macromates.com/textmate/manual/</a><br>> environment_variables#environment_variables]. There are a number of<br>> commands that do similar things in most bundles, certainly in
<br>> GTDAlt and LaTeX bundles. It should be a short 5-6 line ruby<br>> script, if the text manipulation you want to do is simple like<br>> above. I'll try to write an example when I get a chance.<br>><br>
>> TIA<br>>> Helmut<br>><br><br>I spoke too soon here. Actually there is no way to do what I<br>described exactly. The gist of it is that you need to set the output<br>of the command to "insert as snippet', so as to be able to decide
<br>where you want the caret to end. However, in order for the snippet to<br>actually overwrite the entire text, you must make it so that TM<br>thinks that there is a selection, and hence it should replace the<br>selection when inserting the snippet. So the input should be
<br>selection with fallback document.<br><br>But in your case you already have the selection there, so the whole<br>document will never end up being entered as input.<br><br>So I think as Dr. Drang suggested a macro is closer to what you want
<br>to do. Depending on whether this "theText" part is the same or<br>different in each case, you would want to use a snippet or command or<br>neither WITHIN your macro. If all you want is to solve the exact<br>
problem you described in the first message, then this is probably<br>what you want (slightly different that Dr. Drang's suggestion):<br><br>select the text you want.<br>Start macro recording (Bundles -> Macros ...)
<br>Copy<br>use cmd + right arrow to move to end of line<br>Press Return<br>Type "theText = "<br>Paste<br>Stop macro recording (Bundles -> Macros ...)<br>Save scratch macro<br>Test scratch macro<br><br>> Haris
<br>><br><br><br>Haris<br><br><br><br>______________________________________________________________________<br>For new threads USE THIS: <a href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</a>
<br>(threading gets destroyed and the universe will collapse if you don't)<br><a href="http://lists.macromates.com/mailman/listinfo/textmate">http://lists.macromates.com/mailman/listinfo/textmate</a><br></blockquote></div>
<br>