2

How to remap C-x with key-chord mode.

(key-chord-define-global "uu" 'what-goes-here?)

https://www.emacswiki.org/emacs/KeyChord

4
  • The question is not clear, to me. What do you want the effect to be? Something about changing the behavior of C-x? Something about uu?
    – Drew
    Commented Oct 11, 2018 at 13:52
  • Right now I have bound chords to various function i.e. bb when pressed very quickly, changes the buffer. I would like to be able to hit uu very fast and be in the mini-buffer behind ctrl-x. So I could type uu - b and and it would be the same as ctrl-x b
    – tjb
    Commented Oct 11, 2018 at 14:04
  • What's C-x bound to, for you. Normally it's a prefix key. Are you thinking of M-x, perhaps?
    – Drew
    Commented Oct 11, 2018 at 19:53
  • Yes that's what I want to do, first for C-x and then also for M-x. Instead of using a prefix key I want to type 'uu' quickly and have it behave as if I had typed the prefix key. When I type 'uu' slowly it should insert 'uu'
    – tjb
    Commented Oct 12, 2018 at 4:20

1 Answer 1

5

Use (key-chord-define-global "uu" ctl-x-map), since ctl-x-map is what C-x is usually bound to.

9
  • ctl-x-map seems to be a variable, whereas I am looking for a function
    – tjb
    Commented Oct 11, 2018 at 13:00
  • 1
    @tjb ctrl-x-map is, as you say, a variable. Its value is a keymap holding all the bindings under C-x. I don't know about this key-chord-define-global command, but for the standard global-set-key, you can binds a key to keymap and it becomes a prefix for those bindings. So (global-set-key (kbd "C-z") ctl-x-map) would make C-z an alias of C-x.
    – Omar
    Commented Oct 11, 2018 at 14:12
  • By the way, @tjb, I just installed key-chord and tried my suggestion and it works!
    – Omar
    Commented Oct 11, 2018 at 16:30
  • I get the following error when I try the answer: Wrong type argument: commandp, ctl-x-map.
    – tjb
    Commented Oct 12, 2018 at 4:18
  • @tjb Weird! I just tried it again and it works for me. I installed the key-chord package from MELPA to try this (it's version key-chord-20160227.1238). Is that what you're using?
    – Omar
    Commented Oct 12, 2018 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.