It just occurred to me that the org-babel prefix C-c C-v must be what it is because of the proximity of c and v in qwerty, and that it would be better for me to use C-c C-f. Is there a simple way to change the prefix for all chords using it?


If you really want to override the binding C-c C-f for org-forward-heading-same-level you can do that as follows.

(defvar org-C-c-C-v (lookup-key org-mode-map (kbd "C-c C-v"))
  "Binding of C-c C-v in Orgmode.")
(defvar org-C-c-C-f (lookup-key org-mode-map (kbd "C-c C-f"))
  "Binding of C-c C-f in Orgmode.")

(define-key org-mode-map (kbd "C-c C-f") org-C-c-C-v)
(define-key org-mode-map (kbd "C-c C-v") nil)

One could also avoid the variables org-C-c-C-v and org-C-c-C-f by substituting their values into the first define-key and by ignoring the value of the original binding for C-c C-f. The variables give you the possibility to easily switch back to the original state without reloading org.

Note that the usage of defvar is kind of protection of the original binding value. When you have already the modified bindings through running the code once and reevaluate the code the values of org-C-c-C-v and org-C-c-C-f are not overwritten by the new bindings because of the special behavior of defvar (see its doc).

You can switch back to the original bindings with:

(define-key org-mode-map (kbd "C-c C-f") org-C-c-C-f)
(define-key org-mode-map (kbd "C-c C-v") org-C-c-C-v)

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.