On 22 Aug 2016, at 10:50, Fabian Zeindl wrote:
I thought about overloading Cmd+Return anywhere inside the parentheses, but I'd need a selector for this first. Best would be If I could get the "match enclosing pairs" as a command input.
You can create a macro that first does the selection, then executes a command, e.g.:
( { command = 'selectBlock:'; }, { command = 'executeCommandWithOptions:'; argument = { name = 'Convert Block'; command = '#!/usr/bin/env ruby print "your code here…"'; input = 'selection'; output = 'replaceSelectedText'; }; }, )
This though leaves your insertion selected, there are other options, like asking for caret to be after insertion, but you probably want to keep the caret where it was.
You lose the caret when you do the selection, one way could be to insert a magic placeholder before doing the selection, then find this in your command, and produce a snippet where the placeholder is replaced by `${0}` (to indicate where caret should go).