Okay, this is a persistent problem for me. As I continue to use emacs more and more, I'm starting to customize it to my needs by installing the packages(and/or defining functions) and the one big problem I face when I configure a package is:- what keybinding to use for commands. I do not want to overwrite the global key bindings emacs ships with.
Right now, to check if a key-binding
is being used for a command or not, I execute counsel-discbinds
and enter the key-binding
to see if it's already mapped to a command. If not, I proceed to map it to a command. But there is another problem, counsel-descbinds
shows mapping only the current active major-mode
. There have been times when I realized OH! I have overwritten another major-mode
binding with this command and I had to again remap to another binding( which sucks :| ).
So, what can I do to avoid overwriting global-key-bindings
. Is there something that lists all the unused key bindings that I could use for a command (which is not being used for any other major-mode
). And whats a good rule of thumb whenever I'm creating new bindings for commands?
EDIT: Adding to the list of answers, I came across these two commands which I find to be very useful when you want to define key bindings:-
(describe-personal-keybindings)
defined inbind-key
(which comes withuse-package
). This lists all thekey-bindings
which are made by the enduser according to mode specific maps.free-keys
command defined in the packagefree-keys.el
. This will show all the key chords which aren't bound to any command for the current buffer. You can also change the prefix key to something likeC-c
, to list all the unbound key chords.
helm-descbinds
. However I usually don't use predefined bindings, so I have to do that anyway.