Analysis of Emacs keys pressed

Here’s the deal: Emacs keybindings make my fingers hurt. I don’t think I ever experienced RSI before I started using Emacs. I guess I’ve been using Emacs for about 6 years. I’m very efficient with it. I can edit almost as fast as I can think, my fingers never need to take a break. But that efficiency comes at a steep price, I feel.

I hypothesize that chords are to blame, and that I would be happier and less achey if I used a modal set of keybindings, like in Vim, in which every key binding is a single character. Not all the keybindings (e.g. $) are a single key press, but most are.

I’ve tried evil-mode, and it’s pretty poor. It doesn’t provide a proper mapping to Emacs; hitting $ doesn’t actually execute move-end-of-line, it executes evil-end-of-line, which does not integrate with existing modes well at all. It’s catering to Vimers, but it’s not good for Emacs power users.

I suspect that I would like to have a global modal switcher that will make C- and M- implicit somehow, so that a SPC e w is equivalent to typing C-a C-SPC C-e C-w. Before sitting down to develop such a system, tackle the problem of how to start and exit the mode, and how to deal with the meta key, I thought I would collect some statistics. (And actually there are systems like sticky keys or chords for Emacs for tackling stuff like this, so it’s not a scary, new area.)

What I wanted to prove (or collect evidence for) was:

I waste a lot of energy on C- and M- commands.

Said commands happen in clusters, which would justify a modal switcher.

I already had a trivial script to print key presses for screencasts, so I modified that to also store the time and mode in the buffer, and I opened a keys.log file to which I would save the key presses for a day.

I then whipped up a script to read in those statistics and print out a summary, to (hopefully) provide evidence for the above claims.

For unique clusters, I’m doing 2.26 commands per cluster. So if I used sticky keys, or a modal switcher, it would not be a gain. E.g. C f f C vs C-f C-f is no gain, it’s actually more presses due to having to hit C again.

But in terms of non-unique clusters, there’s a gain at 3.44 commands per cluster. That means C f f f C vs C-f C-f C-f, which is one key less pressed. If I’m pressing 9218 keys for C-/M- commands, there might be a 20% decrease in key presses.

I’d love to see a similar analysis done of Vim. How often do Vim users switch from insert mode to normal or presentation mode? I will continue recording my keys for the next couple of days.

Very interesting is how much I use navigation functions. In reaction to this, I’m disabling those keybindings and switching to arrow keys. And I’ve found M-e, a more convenient binding for C-M-u. I will also stop using C-d and use DEL.