Remap Vim keys to avoid RSI in left hand
Asked Answered
T

2

6

I always suffered from RSI in my left wrist (see here) and I thought it was because of the twisting motion associated with hitting the ctrl and shift keys. Therefore, I went ahead and bought an Advantage Kinesis keyboard shown below:

enter image description here

However, even with this keyboard, and foot pedals, and mapping the shift key to the Back Space, I still have RSI, again only in my left hand. Then it occoured to me, a great deal of the movement keys are associated with left hand. Here is a non exhaustive list of the things on the right hand, and then the left hand.

Right Hand:

  • p a simple paste statement, almost always used on its own
  • o write above/below current line, almost always used on its own
  • i write at cursor, almost always used on its own
  • u undo, almost always used on its own
  • y yank, used with a motion command, but only a few motion specifiers on right side (ie. (, ), i...)
  • h, j, k, l, single character motion, seldom used.

Now observe

Left Hand:

  • w, e, b motion one word. Very often used with a number, or pressed multiple times.
  • t, f, $ all combined with keys like y, d, or v
  • Ctrl w + h, j, k, or l, for moving windows, and requires a jerking motion with your left hand.
  • Ctrl x Ctrl f omni completion (IIRC)
  • Ctrl f Ctrl g find file under cursor

Now I am sure this is a biased list, but it gets my point across that a great deal of the commonly used motion keys and a few other difficult combinations are situated on the left hand side of the keyboard.

My question is this, is there a non reinventing-the-wheel way to do this? For example are there any libararies that do this? If not, if I switch to DVORAK will this solve any of the problems I mentioned?

Thurible answered 6/5, 2013 at 23:58 Comment(0)
H
2

To answer your Dvorak question about the keys you mentioned:

p, o, i, u, y, j, k, e, $, x are typed with the left hand. h, l, (, ), w, b, t, f, d, v, w, g are typed with the right hand.

So looking at what moves where:

Stay on Left  |    Move to Left   |  Move to Right   |  Stay on Right    
----------------------------------------------------------------------    
e $ x         |   p o i u y j k   |  w b t f d v w g |  h l ( )

They keys you use are still mostly evenly distributed between left and right hands, but most of the solo-keys are now left-hand, and most of the chorded sequences are right-hand.

Also, the process of learning Dvorak will slow you down significantly, which can help to reduce the strain on your wrists while you make the transition.

You can enter a sample of what you regularly type into websites like http://patorjk.com/keyboard-layout-analyzer/ , and see how much more or less distance your fingers have to travel under different keyboard layouts. (There are other neat metrics to look at, too. Click the tabs on the left and explore!)

Harvell answered 7/5, 2013 at 21:5 Comment(0)
W
2

I don’t like the control keys either so I remapped the most used ones to <space>.

Example:

nnoremap <C-W> <space>w

So instead of doing Ctrl+Wh, I do Spacewh, and it works really well.

Westbrook answered 8/5, 2013 at 14:41 Comment(11)
It's not only the placement, for example, on the kinesis advantage, the control key is hit with your thumb. It's that fact that there is a twisting/jerking motion involved, and that you use your left hand way more.Thurible
I use colemak and don't think I twist my wrist when typing letter, however I do when for the shift key. I also suffer from wrist problem. Maybe you should force yourself to move your all hand instead of twisting. I used a wrist band to stop me from twisting my wrist.Westbrook
For some things, like hitting tilde on kinesis advantage, I can do it without twisting. This applies to most buttons. The exception is things that you use a lot and are extremely repetitive. Such as backspace. I am practising using foot pedals, but they have two problems. 1) It works well for modifier keys (ie. Shift) but not things you have to tap, like backspace. 2) if you have multiple monitors and your keyboard attached to your chair/lap it's harder to move around.Thurible
In fact, from my comment above you can probably glean that my criticism is of vim's movement commands. I find it less than trivial to delete a word in insert mode, or to move around in normal mode without having a priory knowledge of how many words to move, or being lucky enough to move to a new sentance, or until a unique character like a capital letter.Thurible
C-W will delete the last word in insert mode. However, maybe you need to exit for the insert mode to delete something, or not use vim ...Westbrook
Alternatively, type slower and make less mistake. You'll have to delete less and (maybe) get less injuriesWestbrook
For example if I type 'The first rule of figt club is' it makes more sense to pound on the backspace key instead of breaking out into normal mode. On the other hand if I type 'The frist rule of fight club is' it is easier to finish the sentence then go back and change 'frist' to 'first', but that regquires me hitting 'b' all the time so it is no better. I my opinion, this is a flaw in Vim I have started to notice now that I use it about 10+ hours a dayThurible
^w or #fri or even Fr would go a the beginnig of 'frist'. If you really can't "navigate" with vim I suggest this plugin : vim.org/scripts/script.php?script_id=3526Westbrook
I appreciate what you mean, but those examples are not accurate. Fr will take you to 'rule' not 'first', also #fri just puts me into insert mode. The plugin looks promising, though, I will have a look at it.Thurible
sorry I meant ?fri and then Fr; should do it ;-)Westbrook
I would do Fr then realize I'm not arrived yet (only at 'rule' and not 'frist'). Then I would repeatedly hit ; (repeat motion command) until I'm at destination. Once is sufficient here. The whole sequence thus yields: Fr; even though there are two mental steps involved. For more advanced moves I mapped EasyMotion to the space key and would do <space>Fr for an interactive navigation.Stunsail

© 2022 - 2025 — McMap. All rights reserved.