On 15/4/2006, at 10:30, Benjamin Jackson wrote:
[...] Seriously, I could in theory do this, but to get the same effect I'd have to copy the text to the clipboard, then select all, then run the command, and I'd have to change the command to use TM_CLIPBOARD_TEXT instead of TM_SELECTED_TEXT. I may get around to it at some point, but unless this feature gets pushed to 2.0, I can wait for a more elegant solution.
Officially 1.5.x is only a bug-fix branch and will not see any new functionality (yes, it happens, but there are no _plans_.) So don’t hold your breath for this to appear in 1.5.x.
As for how to go about this, I attached a bundle with a macro and a script, the macro does:
1) replace all in selection, adding 0xFFFC as the first/last character (this is the unicode object replacement character, so I’d be surprised if your script already have such characters) 2) select all 3) call transform.rb with input set to document and output to insert as snippet
The transform.rb script then reads stdin, does a split on 0xFFFC (resulting in an array with the before/selection/after), snippet- escapes each of the 3 parts, and then inserts a snippet which puts
and <<< around the selection, but leaves those added characters
unselected, when replacing the document.
So it should be straight-forward to add your desired functionality to transform.rb.