7

My left pinky hurts due to repetitively pressing the C button when using Emacs org mode. Not working with Emacs is out of the question, but it needs some rest.

I would like to change theC key for something else for a while. Could I use, say, the ',' button instead?

  • 2
    In my case, the pain went away after I swapped my keyboard layout to use the caps lock key as the control key. You should be able to find a way to swap it here: emacswiki.org/emacs/MovingTheCtrlKey – DoMiNeLa10 May 5 '18 at 13:23
  • @DoMiNeLa10: sounds like a good idea, at least it will change the point of pressure when I use the pinky. – j.j.johnson May 5 '18 at 13:29
  • I use a Kinesis Advantage keyboard which allows me to press the control and alt keys with my thumbs and this helps a lot. The disadvantage is that they are quite expensive. – Qudit May 5 '18 at 14:14
  • 2
    The problem with this type of question is that it invites a discussion regarding remapping keys at the system level v. in Emacs, different keyboards and foot petals, ergonomics / posture of the user while sitting at the computer, various computer programs for different operating systems that remap keyboard shortcuts, etc. In general, these types of questions come up on Reddit with Emacs tag about once every week and there are about a zillion people who all chime in with their personal opinions. I am voting to close this question as it is overly-broad and seeks an opinion versus a solution. – lawlist May 5 '18 at 15:12
  • 1
    Please clarify if your question is "what to do about Emacs pinky" or "how do I make some other key behave as the Control modifier". – Dan May 5 '18 at 16:16
8

Emacs pinky is a common issue, there are severals way to deal with it:

  1. swap Control key to something else (usually Caps Lock).
  2. Use your palm instead of pinky to press Control key.
  3. Use an ergonomic keyboard.

You can check emacs wiki to see how other users do. https://www.emacswiki.org/emacs/RepeatedStrainInjury

  • Upvoting solely for suggestion (2) (although I've tried swapping control, using the side of the hand feels more natural and works with any keyboard. See some more discussion at ergoemacs.org/emacs/emacs_pinky.html – user2699 May 8 '18 at 2:19
3

You can define a key that applies a modifier to the next key in Emacs.

(define-key function-key-map "," 'event-apply-control-modifier)
(global-unset-key ",")
(defun insert-comma (count)
  (interactive "*p")
  (insert-char ?, count))
(global-set-key [(control ?,)] 'insert-comma)
(global-unset-key "\e,")
(global-set-key [(control meta ?,)] 'tags-loop-continue)

Then pressing , then a is equivalent to pressing Ctrl+a. Press , twice to insert a comma.

There are limitations. Ctrl+Shift bindings work if you press , then Shift+key, but for meta you can't press Esc then , then key. If a mode defines its own binding for , or Ctrl+, or Meta+, then it will override the comma-as-a-modifier bindings. Inserting a comma is no longer a self-insert, which has a few consequences (the same as making a character electric) such as breaking undo sequences, not necessarily doing what you'd expect from a self-insert to the selection, etc.

I don't think there's a way to apply this to a specific mode. You can apply it to a specific terminal (but not to a specific window on a GUI) with local-function-key-map but I don't know if that would help you.

See also the Emacs wiki page on sticky modifiers. That doesn't do exactly what you're asking, but one of the features on this page may be an acceptable solution for you.

1

After using emacs for almost 10 years, I think the best way to avoid emacs pinky is to remember:

Bind the keys such that you never press two or more keys at the same time with one hand!

This completely eliminates any hand problems I used to have.

For example, C-x should always be pressed like this: C (right hand) - x(left hand)

Using space or caplock to replace control will delay but not completely prevent your hand problems. The only way to prevent them is to never press two keys at the same time with one hand.

  • 1
    Furthermore, consider (seriously) using sticky modifier keys, such that you don't need to hold a modifier key down while pressing another key. I thought I would hate it, and that it would take me ages to get accustomed to, but I was genuinely astonished by how rapidly I adapted to it. I wish I'd done it many years earlier. – phils Oct 23 at 5:04
0

I just realized that I have used the Ring Finger to press the Ctrl key and that has worked all these years of emacs experience. Hopefully that could mean a new beginning for you.

0

Use the CTRL Key! My professor showed me this in college and I have been using this kbd mapping ever since on any system I use.

  • MacOS - built in kbd mapping
  • Linux - setxkbmap, or on Ubuntu systems modify /etc/default/keyboard and add "ctrl:nocaps" to keyboard options. (XKBOPTIONS="ctrl:nocaps") or (XKBOPTIONS="ctrl:swapcaps") to swap caps and ctrl. The former will give you ctrl as ctrl and caps as ctrl. This is better than tweak tool because you'll get caps as ctrl in tty's as well.
  • Windows - Sharpkeys

Excellent Link: EmacsWiki: Moving the CTRL Key

0

This problem is actually solved in year 2012 when EVIL is mature.

Simple solution,

Please use Spacemacs+Evil. Vim key bindings make sure you type less keys when dealing with text. Use space as leader key so you don't need move finger from its default position too frequently.

In other words, if you don't use key like Ctrl/Alt/Shift/Win/Cmd/Esc, you solve the problem from root cause.

Advanced solution,

Please use Evil. Then measure your frequency of key pressing by using package keyfreq.

See http://blog.binchen.org/posts/how-to-be-extremely-efficient-in-emacs.html for tech details.

If you want to start optimization immediately without using keyfreq, here is my one year data you can use,

https://gist.github.com/redguardtoo/99e69fe3ecfccadeacdb6f1c40978b0c

This solution works on any environment. It also immediately speedup you productivity so you can code much faster. In summary, there is NO side effect at all.

BTW, at the beginning, you only need optimize top 20 commands.

   6008   13.33%  evilmi-jump-items                    %, <visual-state> %, <normal-state> %
   4292    9.53%  winum-select-window-2                , 2, M-2
   3806    8.45%  winum-select-window-1                , 1, M-1
   2522    5.60%  switch-to-shell-or-ansi-term         , x z, C-x C-z
   2280    5.06%  my-counsel-recentf                   , r r
   1910    4.24%  my-multi-purpose-grep                , q q
   1791    3.98%  back-to-previous-buffer              , b b
   1561    3.46%  winum-select-window-3                , 3, M-3
   1379    3.06%  counsel-etags-find-tag-at-point      C-]
   1222    2.71%  eval-expression                      , e e, M-:, M-ESC :
   1153    2.56%  evil-visualstar/begin-search-forward <visual-state> *
    971    2.16%  my-evil-goto-definition              g t
    793    1.76%  copy-to-x-clipboard                  , a a
    654    1.45%  pop-tag-mark                         C-t
    633    1.40%  counsel-imenu                        , i i
    616    1.37%  paste-from-x-clipboard               , z z
    539    1.20%  winum-select-window-4                , 4, M-4
    522    1.16%  toggle-full-window                   , f f
    420    0.93%  evil-toggle-input-method             C-\
    371    0.82%  git-add-current-file                 , v a
    322    0.71%  evilnc-comment-or-uncomment-lines    , c i, M-;
    302    0.67%  backward-delete-char-untabify        
    295    0.65%  my-split-window-vertically           , x 2, C-x 2
    285    0.63%  find-file-in-project-by-selected     , k k
    279    0.62%  delete-other-windows                 , x 1, , s 1, C-w C-o, C-w o, C-x 1, <menu-bar> <file> <one-window>
    278    0.62%  langtool-goto-next-error             , l l
    273    0.61%  find-function                        , h f, C-h C-f, <f1> C-f, <help> C-f
    270    0.60%  kill-buffer                          , x k, C-x k
    261    0.58%  my-split-window-horizontally         , x 3, C-x 3
    251    0.56%  narrow-or-widen-dwim                 , w w
    235    0.52%  counsel-find-file                    , x f
    224    0.50%  winner-undo                          , u u, C-c <left>, C-x 4 u
    203    0.45%  beginning-of-defun                   , b f, <C-M-home>, C-M-a, ESC <C-home>
    202    0.45%  c-electric-backspace                 
    201    0.45%  evil-a-paren                         
    190    0.42%  counsel-describe-variable            C-h v, <f1> v, <help> v
    187    0.42%  org-shifttab                         
    187    0.42%  wg-create-workgroup                  SPC s s
    186    0.41%  evil-surround-region                 <visual-state> S
    155    0.34%  ffip-diff-find-file                  
    154    0.34%  flyspell-goto-next-error             , f e
    153    0.34%  counsel-etags-find-tag               , f t
    152    0.34%  ivy-switch-buffer-by-pinyin          , x b
0

Left alt (i.e., meta key in Emacs config) 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.