[TxMt] Re: Replace document with snippet?

Allan Odgaard throw-away-1 at macromates.com
Sun Jan 1 20:32:48 UTC 2006

On 31/12/2005, at 2:48, Benjamin Jackson wrote:

>>> This would be an awesome feature. Has it been requested yet? Thanks,
>> What does it actually mean?
> Like, for example, I want to pipe my current file through some  
> command that would add some code at a specific point [...] with all  
> the text selected and set the output to "replace with snippet",  
> except this way I can still get the current word or selected text  
> to pass as input to my command.

Ah okay -- for now you can do a macro that does Select All and then  
Filter Through Command… which calls your script -- in that script,  
TM_LINE_NUMBER and TM_LINE_INDEX will reflect where the caret was  
before the select all (so you'll have to find current word yourself,  
and won't know if there was a selection).

As for making this an explicit option, I may allow this later. I'm  
mostly concerned with the complexity of the options, and am trying to  
find some simpler system, like e.g. have an “and remove it” in  
addition to the input options, which would slightly shorten the  
output options and allow for e.g. the combination you seek, though  
then it wouldn't be possible to have the selection replace the  
document, or the document replace the selection (granted, with  
$TM_SELECTED_TEXT this could partly be simulated, should someine  
really need it).

More information about the textmate mailing list