Couldn't you use a macro that selects the entire document and then calls a command that has output "insert as snippet" ?
Yeah, but that's a bit too roundabout for my taste ;)
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.
Don't want to sound like a whiner, but that's my excuse FWIW.
- Ben
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.