I'm not sure how many different situations you need to handle, but this sounds like a job for a macro, not a snippet.
1. Create a document with the sort of text you want to transform 2. Select the text 3. Start recording the macro (look in the Bundles menu) a. Copy b. Arrow down a line c. Type in "theText = " d. Paste 4. Stop recording the macro 5. Test the macro 6. Save the macro and give it a good name and key combination
If the text you need to transform is more complicated than what you described in your message, you may need to do something more complicated than just arrow down one line in step 3b.
On Jan 24, 2007, at 10:48 AM, Helmut Granda wrote:
Hello all,
I am trying to find information in regards of how to copy and paste text in a new line, for example:
before snippet:
myText
after snippet:
myText theText = myText
currently I am able to create a snippet that will copy the selected word and create a new line like this:
theText = $TM_SELECTED_TEXT
but of course this replaces the selected text so I did the following
$TM_SELECTED_TEXT theText = $TM_SELECTED_TEXT
and this works great if there is only one line of text but lets say I need to select a certain word in the middle of a pharragraph then i get the following
before snippet: first word theText second word
after snippet: first word theText theText = theText second word
as you can tell the snippet inserts the comman din the middle of the sentence, is there a way to avoid that?
TIA Helmut
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- Mark Lawrence vCard: www.unified-eng.com/people/MAL.vcf