[TxMt] Copy and Duplicate word snippet
Charilaos Skiadas
skiadas at hanover.edu
Wed Jan 24 17:08:39 UTC 2007
On Jan 24, 2007, at 11:48 AM, Helmut Granda wrote:
> 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?
You would need to use a command, that has as input the entire
document and output probably insert as snippet. Then you would have
to locate the line the caret is at, and then add a line right after
it with what you want. You then need to snippet-escape all the
regular text, and add a $0 at the correct location where you want the
caret to end up.
Sorry, short on time here, but there are ruby libraries that make
most of the above very easy (for instance the escaping part). The
location can be found via the [dynamic environment variables][http://
macromates.com/textmate/manual/
environment_variables#environment_variables]. There are a number of
commands that do similar things in most bundles, certainly in GTDAlt
and LaTeX bundles. It should be a short 5-6 line ruby script, if the
text manipulation you want to do is simple like above. I'll try to
write an example when I get a chance.
> TIA
> Helmut
Haris
More information about the textmate
mailing list