Rebind Your Keys, I Beg You

It’s your editor dammit!

Recently there was reddit discussion about proper finger placement on the most basic chords – next/previous line: C-p and C-n.

Whether you should use your pinky or switch to modal editing is besides the point.

The point is very simple: don’t discount the option of aggressively rebind your most commonly used commands to more convenient keys.

Pretty much nobody would use C-p and C-n for so important functions.

It’s your editor, dammit, and nobody (including me), should tell you how to use it!


This is not a discussion about Emacs defaults

Periodically a discussion erupts, why Emacs still ships with the archaic defaults (some less charitable commentators say “insane”) and whether we should change it.

Depending on your temperament, feel free to weight in, but this article is not about this discussion. Whether Emacs ships with good defaults for humans or Cthulhu monsters from the 10th dimension, is not important.

You didn’t think such a cool technology as Emacs originated on Earth, did you? It’s only fair that they get dibs on the defaults.



Because independently of the defaults, the first thing you will do is rebind them to your convenience anyway.


This is not a discussion about modal editing, either

Many people suggest modal editing. It definitely has its merits, but:

Is hitting ‘n’ and ‘p’ so much better that ‘C-n‘ and ‘C-p‘? A bit yes, but it still pretty bad, right?

Evil takes Vim’s home row keys ‘hjkl‘ for movement, surely that is good!

It is my OCD speaking here, but ‘hjkl‘ is much, much worse than Emacs defaults! Why?

Emacs defaults are just completely insane, period. But vim’s defaults are far worse – because they are almost, almost great. But not quite, which is even worse! 🙂
You are on home row, fair enough, but offset by one key to the right! So close, yet so far!

So even if you use modal editing, it still holds: rebind the most important keys to your convenient defaults.


Switching costs are lower than you think

I know what you think now: but rebinding has its costs!

  1. It takes a lot of rebinding to move around everything the keys to your content.
  2. Takes time to learn the new bindings.
  3. You’ll be unable to use default Emacs.

Here is why it is not so bad:

  1. That is true, but just look at the defaults – there are quite a few keys bound to functions you rarely, if ever, use. All in all, a bit of messing around the config and experimentation, to fid out what sits the best with *you*, will sort this out quickly.
  2. If you find good bindings, it is surprisingly fast to re-learn the keys. I had ‘switch-to-previous-buffer‘ on <f9> since 5 years both in Emacs and Chrome (switch to previous tab). Recently, I rebound it to M-b and got used to it within the first hour of work. This is not the first time I’ve noticed how surprisingly easy is to learn really good keybinds!
  3. Unless you work on many remote, unconfigured machines without tramp, this is never an issue… If this is your only argument, you could give Vim a consideration, as it seems better for these sort of use cases.

It might look daunting at first but it is not an infinite chain of rebinds – the whole process settles quite quickly and you are able to find suitable keys for all needed functions. There are no conflicts with major modes if you leave the ‘C-x‘ prefix untouched.

Binding with global-set-key sorts out >90% of the use cases, the rest are mostly things using mini-buffer – but there you only need a few keys. A cleaner, functionally equivalent, option is to create a tiny minor-mode with all your keys as an overlay.



It’s your editor, dammit, so you decide how to use it!

If you want, you can hit ‘Control’ with your chin and ‘p’ with your tongue while patting your head with one hand and rubbing your belly with the other. It’s your decision!

Or you could bind to something convenient. For you.

Don’t be afraid to rebind aggressively – good bindings are insanely conductive to flow and good against RSI!

And it is not only about movement keys, but about any often used commands.
Give prime keyboard real estate, to functions that work hard!



I feel obliged to tell you what I use for movement 🙂
The keys are: ‘M-jkl;’.
(Though I use Colemak so it is actuall ‘M-neio‘ and I’m learning modal editing so I can drop the Meta. More on that soon.)

But this doesn’t mean you should use these keys!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s