[TxMt] Re: Changing the selection in a script/command

Richard Drake rdrake98 at gmail.com
Sat Oct 11 23:38:19 UTC 2014


That part works, thanks.

What seems to have changed from TM1 is that when $TM_SELECTED_TEXT is set
all of

$TM_LINE_NUMBER
$TM_LINE_INDEX
$TM_CURRENT_WORD
$TM_CURRENT_LINE

are blank. The first two at least I need. Is this a bug?



07952130635
skype: rdrake98
blog <https://dl.dropboxusercontent.com/u/51971271/drake/index.html> -
twitter <https://twitter.com/rdrake98>

On 11 October 2014 13:42, Allan Odgaard <mailinglist at textmate.org> wrote:

> On 7 Oct 2014, at 21:42, Richard Drake wrote:
>
>  It's easy enough to change the current selection with a macro but is it
>> possible in a command written in Ruby?
>>
>
> If you want to insert partially selected text then you can insert as
> snippet and use the snippet syntax to make parts selected.
>
> If you only want to select things in the document (and not insert
> anything) then (in ruby) you can call:
>
>     %x{ "$TM_MATE" -l«selection» }
>
> Here «selection» should be a string in the format described here
> http://manual.textmate.org/references.html#selection-string
>
> Be aware though that such command should be asynchronous, since normally
> TextMate would wait for your command to finish and use its result to change
> the document/selection (which you do not want here).
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20141012/fe3bee6b/attachment.html>


More information about the textmate mailing list