• Tech Tips

    Keyboard Maestro – It’s the Little Things

    I’ve been using Keyboard Maestro to make myself more efficient. Even the littlest things can (and should) be automated to save time.

    I spend a good portion of my day navigating directories in iTerm. Often I find myself jumping up a directory (back) and then listing the directories to get my bearings.

    In about 30 seconds I made myself a quick hotkey that will be active during iTerm sessions (it’s within my iTerm group, which is only active for the iTerm application) and will perform both operations (cd .. and ls). I mapped this to CMD-u which I think of as “up” so it’s easy to remember. Notice there is a return (linebreak) after the ls; this will simulate hitting return, which will execute the preceding commands. I could have added a return keystroke action, but this is just faster and requires less actions.

    I encourage you, if you’re a KM user, to think about the little things and figure out where you could shave off keystrokes, mouse clicks, etc. to make yourself as efficient as possible.

    km-cd-ls

  • Tech Tips

    Determining Your Most Used Commands in Terminal

    I’m always looking to automate things using Alfred, Keyboard Maestro, Text Expander, and Python. I was curious which terminal commands I use most often, so I did some experimenting. Basically I wanted to know how many times I’ve executed each unique command ( ssh myserverx or ssh myservery, not just ssh). I started by piping the output of history to  sort (to group), then to  uniq (to count), then back to sort (to sort by the number of occurrences).

    Unfortunately, the result contained the same number of lines as the original history output. I figured this was because each line had a unique integer prefix (the line number in the history output). As it turns out, ~/.bash_history (where history gets its records) doesn’t contain line numbers. I simply changed the source and it worked like a charm:
  • Tech Tips

    Keyboard Maestro – Paste into Vim (with formatting)

    Vim users frequently run   :set paste  and :set nopaste . Using paste mode makes it simple to paste text while maintaining whitespace, but some other aspects of Vim are reset in paste mode (e.g., autoindent and smartindent). I’m sure there’s a way to make it easier to flip back and forth within Vim (via .vimrc), but if you want a universal way to do this, regardless of the Vim settings that are in place, you may find the following Keyboard Maestro macro helpful.

  • Tech Tips

    Keyboard Maestro – Alfred Integration

    alfredmaestroI’ve been using the Alfred Maestro workflow for a bit now. It’s very nice to be able to call Keyboard Maestro macros via Alfred.

    It took me some time to figure out why some of my macros weren’t available in Alfred.

    Make sure that if your macro group (or macro) is setup to be Available in the following applications that you include Alfred 2 in the list. Also, if you need the macro group or macro to be available in the KM built-in Trigger macro by name you should include Keyboard Maestro as well.