2

I often want to copy some text out of a Magit-buffer - part of a commit message, part of a diff, whatever.

Annoyingly M-w in a Magit buffer inserts a sha1 into the kill ring (magit-copy-buffer-revision), instead of the text between mark and point.

This is driving me insane.

Is there are configuration option or something to avoid this behaviour?

I am not using active regions (transient-mark-mode), which seems to be what Magit was designed with in mind.

1

After loading magit in my ~/.emacs/init.el, I have added this:

(define-key magit-mode-map (kbd "M-w") 'kill-ring-save)

and I regained a sanity point.

  • 8
    Because the normal kill-ring-save binding is in the global key map, you can set M-w to nil in magit-mode-map so it falls back to normal behavior instead of manually redefining it on M-w on the magit-mode-map. – Jordon Biondo Feb 29 '16 at 13:59

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.