3

I love vim keybindings. For older versions of Magit, I used this to allow j/k scrolling:

(define-key magit-status-mode-map (kbd "k") #'previous-line)
(define-key magit-status-mode-map (kbd "K") #'magit-discard-item)
(define-key magit-status-mode-map (kbd "j") #'next-line)

But now, of course, the keymaps have changed. I have a sort of hacked up solution that loops through all the keymaps, but it's quite complicated and brittle.

Is there any easy way to customize keybindings in magit?

3

I have the same issue (and I am the maintainer :-), and I'm afraid there's no completely trivial fix. (I don't use vim bindings, but I use C-{jikl} for character/line navigation, and in Magit i and k to go up/down a section.

To reproduce your old customizations you could do this:

(define-key magit-mode-map (kbd "k") #'previous-line)
(define-key magit-mode-map (kbd "K") #'magit-discard)
(define-key magit-mode-map (kbd "j") #'next-line)

And then search for "k" (M-x rgrep RET "K" RET *.el RET). Finally add for each found match:

(define-key KEYMAP (kbd "k") #'previous-line)
(define-key KEYMAP (kbd "K") COMMAND)
  • Okay, cool. I have a macro that generates all of the bindings for the various maps, so I think I'll be good, then. – PythonNut Jul 2 '15 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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