On Aug 30, 2012, at 10:43 AM, Jérémy Lecour wrote:
As a developer I often want to extract a part of a line of code into a variable, and put it's assignment in the previous line. Example :
something a_method(with, arguments), something_else
would become
my_variable = a_method(with, arguments) something my_variable, something_else
hmm, since you select something anyway, one could think of selecting 'something' as well.
If 'something' consists of one word only then this _very fast written_ snippet should work:
select: "something a_method(with, arguments)"
and invoke that snippet
${1:variable} = `echo -ne "$TM_SELECTED_TEXT" | perl -pe 's/^\s*\w+\s*//'` `echo -ne "$TM_SELECTED_TEXT" | perl -pe 's/^\s*(\w+)\s*.*/\1/'` ${1/\s*//}
Cheers, --Hans