A while ago I wrote a patch for tmux to add Lua support. This adds a
bit more flexibility and performance over writing a shell script that
just runs tmux commands; for instance, you can have lua code that runs
when a window or session is created or destroyed:

function tmux.oncreate.window_pane(wp)
   tmux.send('-t', '%' .. wp.id, 'hello!')
end

This patch adds two commands:

lua-call (lcall): Calls a Lua function in the global environment,
either built-in or user-defined The first parameter is the name of the
function to call, and any extra parameters are passed as strings to
the function. Typically you would run lua-call eval '<lua-code>' or
lcall dofile '<lua-file>' to define functions, then call them with
another lua-call.

lua-reset: Resets the Lua interpreter, clearing out all definitions and hooks.

There is also an option called lua-timeout, which is the number of
milliseconds that Lua code is allowed to run without letting the event
loop run.

This patch also contains options to highlight the status bar when the
prefix key is pressed:

prefix-notify (flag): When 'on', the following options will override
the corresponding options while waiting for a prefix command:

status-left-prefix,
status-left-attr-prefix,
status-left-bg-prefix,
status-left-fg-prefix,
status-right-prefix,
status-right-attr-prefix,
status-right-bg-prefix,
status-right-fg-prefix,
set-titles-string-prefix

I have attached the patch file, which should be applied against git
commit 84c22d053b5ec1cd25e1694fa3889922b9cbe11b.
I didn't include the Lua interpreter itself, but you can download it
from http://www.lua.org/ftp/lua-5.2.2.tar.gz . Just extract that, then
copy the directory lua-5.2.2/src/ to <tmux>/lua/.

- Jared Stafford (jspeng...@jspenguin.org)

Attachment: tmux-lua.patch.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to