I am trying to rebalance/distribute the workload from my index and pinky to other fingers but I keep finding modes/contexts in which I still need to use n/p or their modified version C-n/p in order to achieve what I want, e.g.,

  1. C-c h: helm-org-agenda-files-headings
  2. C-c g a: helm-projectile-ack
  3. magit-status-mode

How can I ensure that all places where n/p are used as key bindings are remapped to the keys I select?


Basic motion

I have remapped n/p to:

(keymap-global-set "M-J" 'next-line)
(keymap-global-set "M-I" 'previous-line)

This way I can use my index (J) and middle finger (I), avoiding the big stretch from using index (n) and pinky (p). It has the downside that it involves more modifiers but since I use home-row mods, those are also in comfortable locations M(ring)-S(index) so it's not so bad.


In my layout, I have assigned the Esc key to my right thumb, so doing C-Esc is quite comfortable, compared to the default keys.

(keymap-global-set "C-<escape>" 'undo)

This mapping avoids using:

  1. C-_ : it requires more keypresses in my custom layout since special symbols like _ are not in the base layer
  2. C-x u: also more key presses

My current mappings file looks like this: weak-pinky.el

Magit motion

The following mapping follows the same principle, avoid over-extension from using the index (n) and pinky (p) fingers when navigating while in magit-status-mode:

(use-package magit
  :ensure t
  :bind (:map magit-mode-map
              ("C-S" . magit-section-backward)
              ("C-D" . magit-section-forward)
              ("M-S" . magit-section-backward-sibling)
              ("M-D" . magit-section-forward-sibling)))

The downside is that it also involves more modifiers, even if they are in comfortable locations:

  1. n/p becomes C-S-s/d
  2. C-n/p becomes M-S-s/d

Inconsistent motion keys across modes

One thing I don't like is that the keys for basic motion are not the same as those for Magit motion.


I have gathered some data from my keyboard (qwerty layout) use and it turns out that n/p are the two most used keys on my right hand. This matches results from keyfreq and also my subjective experience of pinky pain related to the overstretching from going from n to p and vice-versa.


  • What have you tried? How are you checking for existing [C-]n/p bindings? How do you want to remap such bindings - to what keys? The question lacks detail for what you're trying to do.
    – Drew
    Commented Jan 17 at 22:26
  • I have added a couple of examples and also the motivation/background. I hope that helps. Commented Jan 18 at 20:45
  • It's all over the place, and is no longer about [C-]n|p. You still don't explain how you're checking for the existing bindings in your code or how you want to remap those same keys. A link to code isn't what I'm suggesting; show (here) the relevant code bits that you're asking about.
    – Drew
    Commented Jan 19 at 0:02
  • I added the relevant code snippets in my last update, did you notice? In order to check for keybinding availability I use C-h k (describe-key) to see what's currently assigned to a keybinding, based on that I can either overwrite it or look for a different one. Commented Jan 25 at 19:52

1 Answer 1


It seems that you want to globally remap C-n/C-p to other bindings such as M-j/M-i, which can be achieved by directly setting one keybinding to another:

(global-set-key (kbd "M-j") (kbd "C-n"))
(global-set-key (kbd "M-i") (kbd "C-p"))

Now, whenever you previously had to use C-n it would require M-j, etc.

Regarding inconsistent motion bindings wrt. magit, you could similarly bring it in line with what you expect as follows:

(define-key magit-mode-map (kbd "C-s") (kbd "n")))
(define-key magit-mode-map (kbd "C-d") (kbd "p")))

If you'd like to be able to toggle these bindings (or generally tidy-up the configuration), you could define your own global minor mode with an associated keymap, as covered in this answer to a related question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.