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.