First a general remark about un-/setting key bindings. Don't use a hook, instead do it on "library load time". That way you only do it once, which also helps if you later change the binding interactively for the current session. If you had used the hook to change the binding in your configuration, then that binding would be re-established every time you open a new buffer which uses the same major-mode, overriding your other binding again. Also local-unset-key
is mostly intended for interactive use, I think. So use
(with-eval-after-load 'magit-log
(define-key magit-log-mode-map (kbd "<C-return>") nil))
The reason unbinding C-RET doesn't appear to work in the status buffer is that Magit also uses text-property key bindings, bindings that only have an effect for certain parts of the buffer and that are established in keymap different from the mode keymap.
So you will need to search the source for keymaps that establish such bindings. Of course different syntaxes can be used for this particular key binding, but I think I used [C-return]
in all cases (but did not double check). Which leads to the keymaps magit-file-section-map
and magit-hunk-section-map
, both defined in magit-diff.el
.