[TxMt] Re: How to extract part of a line of code and make it a variable?

Jérémy Lecour jeremy.lecour at gmail.com
Thu Aug 30 21:59:21 UTC 2012


Le 30 août 2012 à 19:20, Allan Odgaard <mailinglist at textmate.org> a écrit :

> On Aug 30, 2012, at 5:52 PM, Jérémy Lecour <jeremy.lecour at gmail.com> wrote:
> 
>> […] Does this seems feasible in TextMate?
> 
> A computer can do almost everything as long as you can come up with the proper algorithm. I am rather lost as what exactly the algorithm you ask for should do, besides the “sometimes I have some code, and I would like it to move around a little and introduce a new variable” ;)
> 
> If you have seen the feature in vim, it might be worth simply finding the code for it, and see exactly what it does in which situations.


I'm sorry Allan if I didn't make myself clear or seemed to ask for the moon (for free). That was not my intention.

What I was trying to say is that my first example was voluntarily extremely simple, and the proposed solution didn't work for a more complicated but common situation.

I've been in the software business for many years and I know that we can do anything with the correct amount of effort.
By asking if it was feasible with TextMate it was more of a question about the tools provided by TextMate. Tools that I've had trouble grasping, probably because I've not spent enough time learning them.

As I've (poorly) explained, within Vim the desired feature is done like this (I'll try to get the "real" code) :
* select the portion to extract
* prompt for a variable name
* replace the selected text by the variable name
* insert a new line just above the current one with the extracted portion prefix by the variable name and an equal

Maybe these steps can be reproduced within TextMate.
Using a snippet and a placeholder was not a "requirement" for me, but an idea of a possible solution.


Again, I'm sorry if I sound like a spoiled kid, crying for a free toy. That's not me.
I'm really grateful of your work and your help.

Cheers

Jérémy Lecour
Conception et développement d'applications web
06 22 43 88 94 - http://jeremy.wordpress.com - http://twitter.com/jlecour



More information about the textmate mailing list