2

Is there a way I can stop needing C-X before any shortcut and, for example, just use C-c to leave?

Also, if possible, what disadvantages could this have?

I'm looking for a simpler way of using GNU Emacs, but not sure if I can find one.

David Gomes
  • 5,644
  • 16
  • 60
  • 103
  • 4
    You can remap the key combinations however you want, but simple math tells you there will be things that you can't bind to a single key. – Wooble Dec 20 '11 at 12:58
  • 3
    Don't worry, after a while `C-x` shortcuts will become second nature. *Jake: How often does the train go by? Elwood: So often that you won't even notice it.* – Thomas Dec 20 '11 at 16:28
  • Type ``C-x C-h``. Can you really bind them all to keys? – desudesudesu Dec 20 '11 at 17:47
  • 1
    `C-c` is probably the last key you should rebind to do something else, because it is reserved as the prefix for major and minor modes. See `(info "(elisp) Key Binding Conventions")`. – Michael Hoffman Dec 20 '11 at 21:18

4 Answers4

11

(this is too long for a comment)

Not really an answer but I know that some people hate the "C-x anything" in Emacs not just because you have to "type a lot of keys" but also because from a touch-typing point of view C-x doesn't make that much sense.

But of course in Emacs everything is configurable. I'm using "C-," instead of C-x and I honestly find it much easier this way.

I use my left pinky to hit CTRL, which is the key physically located at the left of 'a' on a QWERTY keyboard: i.e. the key that used to be CTRL but that now often is labelled CAPS-Lock [and you can remap it to CTRL].

I then touch-type ',' with my right hand.

To this end I added this to my config:

(define-key global-map [(control ,)] ctl-x-map)

You won't have less keys to type to do, say, a C-x C-c (which you can now do both by doing C-x C-c or by doing C-, C-c), but at least you won't be distorting your fingers as much ; )

Also note that as explained here (see user "scottfrazer"'s +40+ upvoted and accepted answer) it may be better to create a minor mode for all your key mappings instead of directly define a global mapping:

Globally override key binding in Emacs

Community
  • 1
  • 1
TacticalCoder
  • 6,275
  • 3
  • 31
  • 39
  • Took me several hours to realize that there is no apostrophe before "ctl-x-map"… But thanks anyway! :) – balu Sep 17 '12 at 02:55
1

After looking at the source code of boon.el, I found out about ctl-x-map. C-x is a prefix key, prefix keys often have their own maps. To use M-m for C-x shortcuts and unbind C-x, use this

(global-set-key (kbd "M-m") 'ctl-x-map)
(global-set-key (kbd "C-x") nil)
0

I think it is a very bad idea, because the C-x prefix can handle such situations like C-x s vs C-x C-s. And: you are really f*cked when you read emacs tutorials and have your own keybindings If you want some other keybindings read ErgoEmacs Keybinding or How to Set Emacs's User Interface to Modern Conventions

Martin
  • 157
  • 1
  • 3
  • 8
Ocaso Protal
  • 19,362
  • 8
  • 76
  • 83
0

My recommendation is to first learn the standard Emacs key bindings, then, after a while change whichever ones you think will do you the most good to change.

See also CUA mode, in the Emacs docs -- I don't use or recommend CUA mode, but a lot of people (esp. newbies?) use it to keep their cut, copy, paste key habits.

Drew
  • 29,895
  • 7
  • 74
  • 104