Keyboard Maestro Keybindings

 

I've enjoyed Brett Terpstra's recent posts on Keybinding in OS X. Very interesting stuff. I figured I could perform the same tasks using basic Keyboard Maestro actions and sure enough, it's pretty simple.

The basic macro goes like this:

KM Workflow

 

The macro is triggered by a hot key after selecting some text to surround with a parenthesis. The first action is to cut the selection. Next, the clipboard is piped into a variable. I set a new variable to the text surrounded by the parenthesis. I then delete the last clipboard entry so that I don't contaminate my clipboard with the text. I don't want to keep popping items onto my clipboard as I write and collect links. Finally, I insert the variable as typed text.

A nice feature of Keyboard Maestro is that if I set two macros to the same hot key trigger, I get options for macros. So to perform Brett's "No Spaces" trick of removing leading and trailing white space, I set another macro with the same hotkey trigger but use a filter on the variable. Keyboard Maestro has a number of text filters including a trim filter.

KM Duplicate Trigger

 

Now I can select some text

Text Selection

 

I hit cmd-opt-ctrl-9 and I get a popover with two options. I can select one with the mouse or with the corresponding number key.

KM Selection

 

I end up with a trimmed string wrapped in parentheses. The thing I like about using KM is that I can quickly duplicate macros to create new variations or disable macros quickly without needing to edit a bindings file.

Thanks for the idea Brett.