action_callback
On this page
wakterm.action_callback(callback)#
This function is a helper to register a custom event and return an action triggering it.
It is helpful to write custom key bindings directly, without having to declare the event and use it in a different place.
The implementation is essentially the same as:
function wakterm.action_callback(callback)
local event_id = '...' -- the function generates a unique event id
wakterm.on(event_id, callback)
return wakterm.action.EmitEvent(event_id)
end
See wakterm.on and wakterm.action for more info on what you can do with these.
Usage#
local wakterm = require 'wakterm'
return {
keys = {
{
mods = 'CTRL|SHIFT',
key = 'i',
action = wakterm.action_callback(function(win, pane)
wakterm.log_info 'Hello from callback!'
wakterm.log_info(
'WindowID:',
win:window_id(),
'PaneID:',
pane:pane_id()
)
end),
},
},
}