The question is quite intricate. I am using doom-emacs and evil and I am customizing the keys. Usually, something like

(define-key evil-normal-state-map "g" 'evil-paste-after)

would work. However, the g key seems to be quite overloaded with different functionalities. In my case g works as a leader key for many org-mode, outline-minor-mode and evil-mode commands. First I have a general question:

Is it possible in an easy manner to set the key g to nil for all the modes and to remap the original leader key g to some different key for example y, so all the commands which were initiated with g are initiated with y?
Then I could easily reassign the leader key and set the desired functionality to g key through the function above.

Or is there only a hard way of finding all the key-maps where g works as a prefix and disable each of them individually?
This would be quite tedious. As an example, I have the bindings

outline-minor-mode-map <motion-state> g j
outline-minor-mode-map <normal-state> g j
outline-minor-mode-map <visual-state> g j
outline-minor-mode-map <motion-state> g h
outline-minor-mode-map <normal-state> g h
outline-minor-mode-map <visual-state> g h

and I would need first to set them all to nil and this is only a small fraction where g is a prefix I suppose.


I found the solution to my problem. It was easier than I thought. These outline bindings were produced by my own config file and I haven't even noticed it!

I had to comment out

  (evil-define-key '(normal visual motion) kmap
"gh" 'outline-up-heading
"gj" 'outline-forward-same-level
"gk" 'outline-backward-same-level
"gl" 'outline-next-visible-heading
"gu" 'outline-previous-visible-heading)

Furthermore I had to the lines

(define-key evil-normal-state-map "g" nil)
(define-key evil-motion-state-map "g" nil)
(define-key evil-normal-state-map "g" 'desired command)

to make g the desired command (in my case the desired command was 'evil-next-line).

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.