<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 22 Aug 2016, at 10:50, Fabian Zeindl wrote:</p>
<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">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.
</div></blockquote></div>
<div style="white-space:normal">
<p dir="auto">You can create a macro that first does the selection, then executes a command, e.g.:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">(
{ command = 'selectBlock:'; },
{ command = 'executeCommandWithOptions:';
argument = {
name = 'Convert Block';
command = '#!/usr/bin/env ruby
print "your code hereā¦"';
input = 'selection';
output = 'replaceSelectedText';
};
},
)
</code></pre>
<p dir="auto">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.</p>
<p dir="auto">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 <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">${0}</code> (to indicate where caret should go).</p>
</div>
</div>
</body>
</html>