I have rebound C-u to another function, and try to use C-j for the prefix, but now it seems I cannot use the prefix in org-mode. It does seem to work in other modes though.

; This is the relevant part of my current config (I think)
(global-set-key "\C-j" 'universal-argument)
(define-key universal-argument-map "\C-j" 'universal-argument-more)
(define-key universal-argument-map "\C-u" nil)
(define-key global-map "\C-u" nil)

(use-package org
  (:map org-mode-map
        ("C-e" . next-line))

How can I make C-j the prefix in org-mode?


Your code will work for any mode that doesn't bind C-j for some purpose. orgmode binds C-j to org-return-indent in the org-mode keymap. The major-mode keymap takes precedence over the global keymap, so your modifications have no effect.

To make this work in org-mode, you'll need to bind C-j specifically in the orgmode keymap:

(define-key org-mode-map "\C-j" 'universal-argument)

You will run into the same problem in any mode that uses C-j for something. You might find some useful ideas in this answer.

| improve this answer | |

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.