I often come across repeated actions. Like Ctrl+V Shift-Ctrl-Down for pasting and jumping down the edit step along the track.
I would really love to be able to make such workflows easier. But such “simple” things aren’t really worth their own tool or much lua code at all, as they maybe occur once or twice when I’m building a track.
Now, I thought, the best thing would be to write a tool that allows me to capture (or at least make lists of) Key-presses. So that they can be bound to a button in a tool or to another key binding.
Like in Vim (one of the popular editor choices for Unix programmers , where you can make things called “complex repeats” where your key presses are recorded into a buffer, so that you can repeat them later. On top of that Vim allows repeated actions: For example typing in “dd” will delete a line, and typing in “3dd” will delete 3 lines.
Such features for easily repeating things while editing things would of course be great to have natively in Renoise. But on the other hand, it sounds like the perfect candidate for a Lua tool that could implement this.
I’ve taken a look at the Lua API, and saw following things for key bindings:
renoise.tool():has_keybinding(keybinding_name)
-> [boolean]
renoise.tool():add_keybinding(keybinding_definition_table)
renoise.tool():remove_keybinding(keybinding_name)
That great for invoking Lua functions. But unfortunately you can’t “invoke” existing key bindings with that. What I would love to have would be:
renoise.tool():get_keybinding("Pattern Editor:Insert/Delete:Insert New Row")
-> [callback/function] (pseudo-type, i'm not too fluent in Lua currently ![:)](https://files.renoise.com/forum/emoticons/default/smile.gif)
Or just:
renoise.tool():invoke_keybinding("Pattern Editor:Insert/Delete:Insert New Row")
That would allow scripts to “collect” those callbacks and execute them on a button press or anything else.
Better would maybe even be a way to capture the key presses directly using Lua and being able to emit
arbitrary key presses - or even mouse actions. Something like:
renoise.tool():add_keycapture {
invoke = function(key, modifiers, key_up)
....
end
}
And:
renoise.tool():invoke_keypress(key, modifiers)
renoise.tool():invoke_keyrelease(key, modifiers)
And/Or maybe something like:
renoise.tool():invoke_key(key, modifiers, hold_time)
I hope I haven’t missed anything in the Lua API. And I don’t know if others understand what I mean. But I thought I would write this anyways