Re: [code] Re: [textadept] run external app from editor

From: Mitchell <>
Date: Mon, 28 Dec 2015 11:22:04 -0500 (EST)

Hi Thorsten,

On Mon, 28 Dec 2015, Thorsten Kampe wrote:

> * Mitchell (Sun, 27 Dec 2015 14:58:25 -0500 (EST))
>> On Sun, 27 Dec 2015, Thorsten Kampe wrote:
>>> I would like to be able to run two external commands from within
>>> the editor:
>>> 1. `runscript` with the argument of the filename in the current
>>> buffer. This should be possible for all file types - as runscript is
>>> a wrapping extension to interpreter. Output of `runscript` should go
>>> into a buffer of Textadept.
>> You can put something like this in your ~/.textadept/init.lua:
>> [...]
> Thanks, that works beautifully.
> Just a few related questions:
> - is it possible to reload init.lua from within the editor without
> closing and reopening Textadept?

Sure. Open the command entry, type "reset()"[1] (no quotes), and press

> - is there a function to return the word under the cursor? (so I
> don't have to select text I search for)

You have two options:

(1) textadept.editing.select_word()
        local word = buffer:get_sel_text()

(2) local s = buffer:word_start_position(buffer.current_pos, true)
        local e = buffer:word_end_position(buffer.current_pos, true)
        local word = buffer:text_range(s, e)

The first modifies the selection and uses that to get the word, and the
second gets the word silently.

> - is it possible to force Textadept to open only a single instance
> and to open all files in new tabs/buffers? (When I drag and drop
> multiple files to the editor, they all open in tabs...)

It depends on what platform you're on. The manual should help you with



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 28 Dec 2015 - 11:22:04 EST

This archive was generated by hypermail 2.2.0 : Tue 29 Dec 2015 - 06:53:09 EST