Should You Use Key Shortcuts or M-x

Over at the Emacs subreddit, domsch1988 has an interesting question: Is it better to use key shortcuts or Meta+x? The question is not as silly as it seems. Domsch1988 acknowledges that sometimes the choice is obvious. No one, for example, is going to invoke Meta+x find-file instead of Ctrl+x Ctrl+f. Likewise, there are plenty of commands that, even if they have key shortcuts, you use so seldomly that you simply won’t remember a shortcut.

So the question is, how do you choose the best method? It’s interesting to read through the comments. One of the best pieces of advice, I think, is to use a hydra or transient to capture diverse, hard to remember commands in a menu-like interface. For example, I have a hydra for dealing with windows. All the window commands I use, even infrequently, are gathered there and can be invoked with a simple key command. If I forget the whole command, a short menu will pop up in the minibuffer to remind me. It’s a lot like which-key except that there only a few choices so I don’t have to hunt through a bunch of choices to find the command I want.

To be sure, a key shortcut is quicker but even Meta+x can be fast if you have some sort of command completion engine such as Ivy installed. It’s likely that the optimal solution is highly dependent on the user so there’s probably no “good” answer that everyone should employ.

I don’t have an overarching strategy. I simply make the choice on a case-by-case basis. What do you do?

This entry was posted in General and tagged . Bookmark the permalink.