Avoid overlapping keys in emacs?

I searched a little and can’t find what I was looking for, so I decided that I would ask. This may be due to the fact that you are not using the correct conditions.

I'm new to emacs using vim for eight years or so, but I really need an editor that I can convert to my will to switch. Vim now has a leader key that you can define to avoid bindings with various extensions. Emacs assumes that chords are delayed only for the user, but different modes do not adhere to this. Is there a way in emacs, can I ensure that my user bindings do not overlap, like the vim leader key? The reason I ask is because I want my bindings to be normal.

+2
source share
3 answers

The manual details the conventions:

Ch i g (elisp) Key Binding Conventions RET

Sequences reserved for the end user:

  • Cc <letter> for any (unmodified) upper or lower case letter: [A-Za-z]
  • Function keys F5 , F6 , F7 , F8 , F9 (again without modifier keys)

I recommend using the simplest of these sequences as prefix bindings, since you can follow them with any key at all, giving you a large number of options.

Someone else I liked should have canceled Cz unless you usually use suspend-frame , as this opens up another convenient prefix.

Of course, if you installed the Super and Hyper modifier keys for your OS and keyboard, you will probably get more convenient sequences than you might find. This is a very smart option for many people with the extra modifier keys found on many modern keyboards.

Finally, the key-chord library is a fairly popular way to create new convenient and non-conflict bindings using pairs of (un-modified) keys typed together or in quick succession (or one key is pressed twice). This works very well in my experience, although you obviously have to be very careful to avoid linking sequences that can occur naturally.

+5
source

I personally use C- 'as my "leadership key" for my personal key binding map. You can create a prefix and bind it like this:

 (global-set-key (kbd "C-'") ctl-quote-map) (define-key ctl-quote-map (kbd "Cp") 'stumpwm-move-window-up) (define-key ctl-quote-map (kbd "Cn") 'stumpwm-move-window-down) (define-key ctl-quote-map (kbd "Cf") 'stumpwm-move-window-right) (define-key ctl-quote-map (kbd "Cb") 'stumpwm-move-window-left) (define-key ctl-quote-map (kbd "r") 'stumpwm-interactive-resize-window) 

Nobody steps on something obscure, and if you use the left control, this is a balanced double Misino movement. C-; is also good, and this is what I use stumpwm for the escape key.

+1
source

There are Emacs binding conventions , some of which honestly surprised me.

The relevant parts are that Cc [a-zA-Z] and <F[5-9]> reserved for end users.

+1
source

All Articles