[TxMt] Re: [TM2] DIALOG2 replace input via HTML Javascript TextMate.system()

Allan Odgaard mailinglist at textmate.org
Sun Sep 28 08:44:45 UTC 2014


On 27 Sep 2014, at 18:41, Hans-Jörg Bibiko wrote:

> Is it possible for a command (Input: “Selection” - fallback to 
> “Line” ; Output: HTML window) to replace the "Input selection" via 
> Javascript's TextMate.system()?
>
> TextMate.system("$DIALOG x-insert --text 'foo'", null) works but only 
> for a selection and not for the fallback situation.
>
> Has anyone an idea?

Untested, but you could run this if TM_SELECTED_TEXT is unset:

     TextMate.system('"$TM_MATE" 
-l"$TM_LINE_NUMBER-$((TM_LINE_NUMBER+1))"', null)

Then it will select the current line and x-insert should thus replace 
it.

By default "$TM_MATE" works on current document found via the 
TM_DOCUMENT_UUID environment variable.


More information about the textmate mailing list