Avoiding overlapped keybindings in emacs?

后端 未结 3 958
北海茫月
北海茫月 2020-12-20 03:18

I have done some searching around and can not quite find what I am looking for so I figured I would ask. This could be due to not using the right terms however.

I a

相关标签:
3条回答
  • 2020-12-20 03:45

    The manual details the conventions:

    C-hig (elisp) Key Binding Conventions RET

    Sequences reserved for the end-user are:

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

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

    Someone else's recommendation that I liked was to unbind C-z if you don't commonly use suspend-frame, as that opens up another convenient prefix.

    Of course, if you set up Super and Hyper modifier keys for your OS & keyboard, you would likely gain more convenient sequences than you could find uses for. This is a very reasonable option for many people with the additional modifier keys found on many modern keyboards.

    Finally, the key-chord library is quite a popular way of creating new convenient and non-conflicting bindings by using pairs of (un-modified) keys typed together or in quick succession (or a single key tapped twice). This works very well in my experience, although you obviously have to be very careful to avoid binding sequences which might occur naturally.

    0 讨论(0)
  • 2020-12-20 03:49

    I personally use C-' as my 'leader key' for my personal keybinding map. You can create the prefix and bind keys to it like so:

    (global-set-key (kbd "C-'") ctl-quote-map)
    (define-key ctl-quote-map (kbd "C-p") 'stumpwm-move-window-up)
    (define-key ctl-quote-map (kbd "C-n") 'stumpwm-move-window-down)
    (define-key ctl-quote-map (kbd "C-f") 'stumpwm-move-window-right)
    (define-key ctl-quote-map (kbd "C-b") 'stumpwm-move-window-left)
    (define-key ctl-quote-map (kbd "r") 'stumpwm-interactive-resize-window)
    

    Nobbody steps over something that obscure, and if you use the left control it's a balanced double pinky motion. C-; is also good, which is what I use for the stumpwm escape key.

    0 讨论(0)
  • 2020-12-20 03:52

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

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

    0 讨论(0)
提交回复
热议问题