11

I'm very new to Emacs and I'm trying the built-in tutorial. After I went through the basics, I found it really hard to reach the Ctrl and Alt or Esc keys. I'm trying to type faster but since all the commands require these keys, I'm not able to be fast at all. I have searched, but it seems that nobody is complaining about these keys.

I already know that you can swap the Ctrl and Caps Lock keys, but I prefer not to do that because I heard that it is not recommended.

How can I make it easier to type commands?

  • 7
    I've mapped Caps Lock to work as another Ctrl key years ago and I'm completely happy with it, even when not using emacs. It's so much better to have it directly in the home row, that I have no idea who would recommend against it. – Ineu Jan 6 '15 at 20:05
  • 1
    One argument against this is that presumably folks who do this (like me!) always use their left pinky and thumb to press modifier keys. A more balanced approach would be to use both the right and left ctrl and alt keys such that one hand hits the modifier and the other the target key. But I've got years of muscle memory with caps-lock as ctrl and am happy with it. – glucas Jan 6 '15 at 20:09
  • 1
    You should not need to use Ctrl and Alt for normal "typing." Key bindings that use those modifiers will help you navigate the text, kill (cut), yank (paste), open files, and many more things. With the notable exception of Vi, I think you will find that all text editors will require you to use modifier keys for these types of functions, or else use the mouse. When you say "fast" what is your frame of reference? Fast compared to what? (As a side note: I love mapping Caps Lock to Ctrl and would recommend it to anyone.) – nispio Jan 6 '15 at 20:11
  • 2
    Here is a link to the same / related thread entitled What is the best way to avoid getting “Emacs Pinky”?: stackoverflow.com/questions/52492/… The thread dates back six (6) years and has over 12,940 views and 31 different answers. – lawlist Jan 6 '15 at 20:41
  • 1
    Welcome to Stack Exchange. I've reworded your question to be a how-to question rather than a poll question, because Stack Exchange doesn't do poll questions. – Gilles 'SO- stop being evil' Jan 6 '15 at 22:05
22

This is a hard question to "answer", but a few thoughts:

Try working with the default key bindings for a while, because Emacs will definitely feel strange at first. I would not suggest making major configuration changes until you have a better sense of what works and doesn't work for you.

You'll find Emacs users on both sides of the caps-lock vs. ctrl argument. Personally I've used caps-lock as a ctrl key for a long time and find it very convenient. I use my left hand for all modifier keys: generally my pinky for Caps Lock (C-)and Shift, and my thumb for Alt (M-). I've done this for years and am happy with it. I do see the sense of being able to hit modifier keys with either hand but that just isn't how I learned.

There are modes that do not depend on modifier keys as much. If you like the Vim style of modal editing you could try Evil or the more Emacs-like god-mode. But I'd still suggest spending some time with the defaults.

As you get more familiar with Emacs and learn what commands and modes you find most useful, then you can start tinkering with key bindings. Function keys can be used as a prefix to save yourself some use of modifiers, though you have to reach for them. There are packages like key-chord that let you bind repeated keys (like jj) or key chords (like jk) to commands. There are also things like smartrep that allow you to use single keys to continue performing commands after some initial command, which can be used to avoid having to hold down some modifier combo. But setting up those kinds of packages requires knowing what commands you want to rebind, which requires some experience first.

  • A week ago I switched caps lock for control and I have a question for people who do it : do you hit caps lock only with the pinky or also with the ring finger? I've found it that usually when I'm writing code I hit it with the pinky but when I'm not actively writing (for example when I'm navigating code) I use my ring finger as it's much more comfortable. – MonsieurBanana Jun 17 '15 at 13:15
  • I think I always use my pinky -- but go with whatever works! – glucas Jun 17 '15 at 19:14
  • The way I use modifiers is essentially identical to yours, with the addition of using the right thumb to press the alt gr key when I need to write accented characters from my layout. I don't really need to use it that often, but it's worth mentioning that this approach scales well to layouts that rely on that key. – DoMiNeLa10 Feb 18 at 17:08
10

I've got myself for Christmas a Kinesis keyboard. I will not post links so that not to make this an advertisement. Keyboards with similar qualities will do too.

Before that I had a Steelseries keyboard with additional Ctrl mapped to Caps Lock. The important things I needed to learn (with my old keyboard) were these:

  • Press M-x with both hands. I can reach right Ctrl key on my laptop keyboard, but not on my old desktop one. If reaching it is doable, you should learn to press C-x, C-r, C-s, C-a, C-e and C-c etc. with both hands too.
  • Use right Shift whenever possible.
  • If you stick with the straight keyboard, well, you have to train your pinky! Same way as piano players play five-fingers exercise.
  • Don't use Home, Pagup, Pagedown and End as well as arrow kyes.
  • Some commands may have alternative key bindings, which might be longer, but easier to press (require less keys pressed simultaneously).
  • If you decide to try an ergonomic keyboard, you'd have to do some remapping and, instead of training the pinky, you'd have to train your thumbs.
  • 1
    Upvote for the "both hands" tip, that's one you don't see often. I too often do C-x C-f with just my left hand and it really starts to hurt my left pinky. Instead, putting right index finger on right control and then left index finger hits x, f, it's much better. – robru Jan 11 '15 at 19:07
  • Speaking of piano, you can try using your thumb to press modifiers (like when you cross over playing a scale). For example: Thumb down on Ctrl, roll your arm, and press x with your index finger. Instead of squeezing your hand tightly, you're relaxed and using big arm muscles. This doesn't work for all combos but you can try it especially for the lower-left corner C-a C-c C-d C-s C-x "scrunch fest". – Greg Hendershott May 28 '15 at 14:55
4

step 1, install evil-mode (http://www.emacswiki.org/emacs/Evil). It uses vim key bindings and provides advanced vim features like text objects, so you type much less Ctrl, Alt

step 2, use evil-leader (https://github.com/cofi/evil-leader), you press leader key (I map it into ",") first then type combination of any keys to trigger a command. Please take full advantage of it, you will never need Ctrl and Alt any more, for example, I use ",mx" to replace M-x

step 3, install evil-escape (https://github.com/syl20bnr/evil-escape), you press "kj" to simulate "C-g" and "ESC"

This solution works in any terminal, BTW.

An brilliant example is spacemacs https://github.com/syl20bnr/spacemacs (but SPACE key is used as leader key there)

2

I use the Dvorak layout and I found that it works very well with Emacs default key bindings. C-n is on the home row and C-p can be pressed with the index finger instead of the pinky. C-u (the prefix key) is on the home row as well.

I swapped Caps Lock and Ctrl on all keyboards because I find it easier to type certain key combinations. I also bound M-x to the menu key (right of the space bar), because that's easier for me to hit than left Alt and x.

Other than that I do use god-mode to make longer editing sessions a little more comfortable. I do not find Emacs keys to be an obstacle and I use the defaults mostly.

Like @glucas I use the left pinky for Ctrl and my left thumb for the left Alt key. On the Truly Ergonomic Keyboard I bound the left space key to Alt which makes this much less awkward than on a regular keyboard.

If you are worried about stressing your left hand too much by swapping Ctrl and Caps Lock, you can even bind Ctrl to the Return key. See this article for more information: http://emacsredux.com/blog/2013/11/12/a-crazy-productivity-boost-remap-return-to-control/

1

TL;DR: make sure that important keys aren't hard to reach.

I second wvxvw's answer about Kinesis as preventative against "Emacs Pinky". I've used mine for 14 years so the investment has pretty much paid off by now I'm sure. On the Kinesis, I mapped the bottom row to modifiers (s-H-C-M / M-C-H-s) and have Mode_switch on thumb keys to access "embedded arrow keys". This set up leaves very little to be desired.

There are still times when I have to or choose to type on a laptop, and I have something similar set up, remapping the number row to modifers, and putting the number symbols on the function keys (see my .xmodmap or .xkb file for details). This, again, means that there is little torsion on my wrists, and no stress at all on the pinkies.

In recent months I've noticed some stress in the fingers I use for Control and Mode_switch on the laptop. It's always a good idea to try to reduce stress when you notice it. I played around with sticky keys, but I found that current support for them leaves a lot to be desired. A pity, because they are a really good idea.

However, I've had some luck with God mode, which is like a souped up sticky Control key, but only within Emacs. Messing around with that and Evil mode, I observed that it is straightforward to define a similar sticky Meta key -- or you could define other modifiers or embedded layers. evil-dvorak is one related optimization, although the selected keymap is somewhat personal.

To summarize the main ergo-relevant customizations that have helped me "live in emacs" to a reasonably high degree:

~10 years: Kinesis, dvorak, Xmodmap/Xkb, Ratpoison (important: set RP's escape to something within reach, C-t is the default, but that can easily be improved upon)

~1 year: Pentadactyl (with Emacs bindings), God mode + Evil mode (an unholy alliance), and switching to a standing desk during part of the day. Also, Helm for quickly entering commands.

0

You will notice that this is a very touchy subject among long-time emacs users. As other responses here have suggested, try the defaults for a bit to find out what key sequences are particularly difficult for you, for the languages you type on your particular keyboard. Then implement one or two remaps of critical keys, such as Ctrl, Meta, and Escape. Depending on your laptop and OS, you may have several ways to remap. For example on Mac OS X, keyboard preferences panel along with Karabiner will be sufficient to find a workable remap of keys. Try one solution at a time to see if it suits your needs. It may take sometime to find what fits your needs. Long-time users will suggest avoiding overloading your pinky fingers. Take heed.

0

This issue is not specific to Emacs. Users of other programs that can be controlled with keybindings suffer too. Emacs has it to a greater degree because it has more commands. The fundamental reason is that there are not enough keys for all commands we need. If you are not interested in theory, skip to the last paragraph.

An obvious solution is to add an additional keyboard for Emacs commands. Then you will have 200 keys in total. Then you will type even slower. Actually, 100 keys on the standard keyboard is too many for touch-typing. I estimate that a human can reach at most 22 keys with one hand without moving the wrist.

To type quicker, you move modifier keys under the fingers. Then there is not enough keys for Latin letters. For example, 'j' is a modifier key, pressing 'j' and then pressing 'd' produces the letter 'j'. If you don't like pressing a modifier key for every letter, you use modes and modal editors. For example, in the insert mode, 'j' produces the letter 'j'; in the command mode, 'j' preforms cut (kill); there are keys to switch modes. (These examples are not implemented in any editor, they are just examples.)

Vim is a renowned modal editor. It was mentioned above. As Emacs is programmable, there is a modal minor mode called the God Mode. It serves the need, though it can be improved. In the God Mode, you don't need to learn a new keybinding for every Emacs command, however, you need to translate every keybinding into a sequence of keys in your head. For example, 'g w' produces the command bound to 'M-w'.

0

In short, press them all easily with the thumbs. You can do it without Kinesis.

Now the details. Buy e.g. a Japanese keyboard:

Japanese keyboard
(source: owltech.co.jp)

and use the bottom row both e.g. as AltShiftCtrlShiftAlt and EscBSSpaceRetTab, the middle one being the physical space bar. It means that if you press the space alone, it's a plain space, but when pressed with others, it'll be Ctrl. Same for Alt/Esc, Shift/BS etc.

For how to actually achive it, see What is the best way to avoid getting “Emacs Pinky”? in stackoverflow.com. (This question is already referred to by Gilles)

You can buy Japanese keyboards at e.g. ebay.com or amazon.com. amazon.co.jp is available in English, too.

0

Left alt (i.e., meta in emacs) key can be pressed easily using your left thumb, and you can rebind all of your common functions (e.g., cursor movements) to meta-key-based shortcuts instead of the original ctrl-key-based shortcuts. I do that in my init.el file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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