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!
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!
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.