0

I would like to override the C-c C-j keybinding. I put this in my init file

 (global-set-key (kbd "C-c C-j") 'counsel-org-goto)

However, it won't override the command org-goto (found in org-mode-map).

Thanks for your input!

2
2

Try this expression:

(with-eval-after-load "org"
  (define-key org-mode-map (kbd "C-c C-j") #'counsel-org-goto))

The Org mode keymap "shadows" the global map. In Emacs, the keymaps of major modes take precedence over keybindings in the global keymap.

See this excellent tutorial from Mickey Petersen for a thorough discussion of the "keymap lookup order": https://www.masteringemacs.org/article/mastering-key-bindings-emacs.

2
  • Thanks Phil, that's better.
    – Tom Davey
    Jul 13 at 17:42
  • This worked like a charm! I understand the logic. Thanks so much.
    – Adelita
    Jul 14 at 8:54

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.