Vim users, where do you rest your right hand?

Longtime vim users, do you keep your fingers onjkl; or hjkl in normal mode?

Standard touch typing teaches us the home position for the right hand has the index finger on the j key, so your fingers are on jkl;.

But standard vim motion keys are hjkl.

I'm getting back into vim after 10+ years (omg, I got old when I wasn't paying attention) and find myself gravitating towards hjkl ... but that makes it harder to type upper-right letters, braces, etc. I'd like to train myself to use the most efficient/pragmatic method now instead of having to re-train later.

Longtime, hardcore vim users, what's the best practice?


Note:

  1. Bigger overlap with How do touch typists navigate in vi?
  2. I think this passes the "subjective" test because it's about deliberately cultivating an unconscious best-practice and not simply about people's preference
26773 次浏览

I think that jkl; is actually the more appropriate usage for vi. For one, h and l really don't matter that much. w, e, and b are significantly more useful for horizontal navigation. As a bonus, ; is easy to get at if the language requires it. Having a weaker finger on k hurts, and you don't need your strongest finger on the h, when it should be on the j which is probably the most used of the four.

I keep my hands on the home row, in the normal touch-typist manner. Rarely do I use the h key for movement, as moving one space to the left is not usually an efficient way to move (and does not really fit the essence of Vim).

Intro

Neither of the previous 2 solutions was 100% satisfactory. I propose a 3rd way, one that combines the best of both worlds

My Recomendation: "down-up-left-right"

Keep up/down where they are, then make 3rd & 4th fingers left & right

Then, to avoid overwriting base Vim features: Toss whatever used to be on ; to the now-empty h button

As a cute bonus, the "l" key now stands for "left" ;)

noremap l h
noremap ; l
noremap h ;



The previous "runners-up", who both use "left-down-up-right" layout:


Choice 1: "hjkl"

@alternative's recommendation. Keybinds stay default (hjkl), right hand stays on home row (jkl;)

  • pros:
    • j (down) and k (up) stay on your primary 2 fingers, where they deserve
  • cons:
    • You have to reach over for h (left). Even if this isn't as used as w,e,b, it's still a bloody arrow button and it would be nice to have on home row
    • Basically: All 4 fingers aren't naturally resting on arrow buttons. This confuses my hand


Choice 2: "jkl;"

Slide those 4 binds over 1 so they sit on the home row:

noremap ; l
noremap l k
noremap k j
noremap j h

  • pros:
    • No finger confusion; all the arrows are under the fingers naturally
  • cons:
    • As @alternative said, up/down being on the 2nd and 3rd finger is very "non-optimal"
    • Similarly, the strongest finger being on left is also a waste

I understand, that hjkl is used for historic reasons (i.e. Here is why vim uses the hjkl keys as arrow keys) and it is not based on any ergonomic rationale.

I personally prefer to follow the approach recommended by i3 window manager which as explained in the FAQ on Why does the default config use jkl; instead of hjkl? is an ergonomic choice.

i3 uses jkl; because these keys make up the "home row" underneath your right hand when touch typing.

Check this on vim remapping the hjkl to jkl;

While I understand Vim's philosophy of having all the movement available in the home row, I found hjkl to be counter intuitive. A much more saner map I thought would be a wasd-like setup with ijkl

    nnoremap j h
nnoremap k j
nnoremap i k

I found this to be very easy to navigate with very natrually.

j:left
i:up
k:down
l:right

For toggling in/out of insert/normal mode, I personally use Alt-e since I almost always use Gvim and not have to worry that some terminals have issues with Alt.

    nnoremap <A-e> i
inoremap <A-e> <esc>l