Screencast: Why Keyboard Macros are Awesome

Back in September I made the assertion that every programmer should be familiar with an editor that can record keyboard macros, even if it’s not the only editor they use. The other day I recorded a little video demonstrating why ad-hoc keyboard macros are so great. It’s not a feature you need every day, but when you do need it it can be a lifesaver.

I’m using Emacs in the video, but this isn’t to say you should use Emacs specifically. Several editors have this capability. The only thing I demonstrate that may not be available in those editors is the ability to easily display and edit the recorded macro.

If you prefer you can download the video.

A subtle point that’s easy to miss: in order for macro recordings to be effective, the editor really needs to support semantic keyboard commands: e.g. “forward one word”, “go to beginning of line”, “forward one expression”, “move forward to the next underscore”, “lowercase word” and so on. Without semantic commands you’d just be recording character-by-character edits which wouldn’t generalize very well.