I’ve just read Mark Miller’s post regarding this other great post on how to create custom embedding using CodeRush. I had actually done that before, but had not hooked it up to shortcuts. That’s extremely easy, useful, and fun!
That got me to go back and improve my custom embedding that wraps up a selection into either an if-block or else-if block. I’ve customized it so that when I have some code selected in the editor, I can hit either i (as in if) or e (as in else), which causes the code to be wrapped in an if or if-else block, respectively:
Below is what my custom if-else embedding looks like (you can figure out the if one…):
And this is what the shortcut look like: