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

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

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

  • 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 Oct 11 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 Oct 11 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 Oct 11 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 Oct 12 at 4:20
up vote 2 down vote accepted

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

  • ctl-x-map seems to be a variable, whereas I am looking for a function – tjb Oct 11 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 Oct 11 at 14:12
  • By the way, @tjb, I just installed key-chord and tried my suggestion and it works! – Omar Oct 11 at 16:30
  • I get the following error when I try the answer: Wrong type argument: commandp, ctl-x-map. – tjb Oct 12 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 Oct 12 at 13:17

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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