How to remap keyboard keys to avoid RSI in VIM

puk picture puk · Jul 12, 2012 · Viewed 7.6k times · Source

I hope this does not come across as an attempt to spark conversation purely for the sake of doing so.

I use vim a great deal (5-10 hours a day) and I noticed my left wrist is the first to start aching. The standard keyboard layout (see image below) is almost guaranteed to give you arthritis.

Standard Keyboard

Currently, I have remapped

  • Ctrl to Shift
  • Shift to Caps Lock
  • Caps Lock to Ctrl

This helps with common commands such as Ctrlf or Shift2 (@), but I still have to twist my wrist to get at those combinations. Is there anyway to remap the keys so as to avoid this twisting on the left wrist (maybe use the Tab key)? I just find it odd that for a text editor designed specifically for programmers, it would make heavy use of these out of the way keys. I have considered remapping to the old keyboard layout (see below image), but I don't want to learn that if it is going to have the same fundamental problems as my current remapping.

old keyboard layout

Answer

Randy Morris picture Randy Morris · Jul 12, 2012

Note: I am not a doctor, just another typist that suffered from wrist pain.


In my experience, just mapping Caps to Ctrl (or swapping the two if you must have a Caps) and using Ctrl+[ instead of Esc make a big difference. Ctrl+[ does not require an additional mapping in vim as it is equivalent to Esc. If you can teach yourself this small change you reduce your movement by a great deal when you consider how often you use Esc in vim.

The Caps to Ctrl mapping can't be done inside vim and will have to be made system-wide, however, having Ctrl in the more convenient location will also help in other applications that use Ctrl combinations. There are different methods of remapping keys depending on which OS you're using. A few common options are:

While this will probably improve your situation you really should consider seeing a doctor and/or purchasing a more ergonomically designed keyboard if your pain persists. I own an older version of the Kinesis Advantage that I picked up used on Ebay for about $100 (USD) and I couldn't be happier. The keys can be programmed directly on the keyboard so no software is needed to swap keys or create your own keyboard macros for frequently used key strokes.


Edit: I see in your post you also mention combinations like Ctrl+f and Shift+2 requiring you to twist your wrist to press. It sounds to me like you're only using the Ctrl and Shift keys on the left side of your keyboard. You should really be using both sets of these keys, using whichever one is on the opposite hand of the key you're modifying. That would negate this wrist movement.