11

I'm a new Vim user, and I want to ask this somewhat elementary question in order to make sure I start learning Vim the right way and don't develop bad habits.

When you use Vim, how do you position your right hand? I find it more natural to start with my fingers on the jkl; keys, but then I find myself missing the h key at times when I'm navigating. Conversely, if I position my fingers on hjkl then I find myself mistyping words as this isn't the position I was trained to keep my hand on the keyboard, and I find toggling the jk keys with my middle and third finger to be awkward.

  • 5
    Definitely keep your fingers at j,k,l,;. For one, you'll learn to hit h in no time. Secondly, when you know vim better, you won't be using h all that much really. Thirdly, keybinds are mostly defined with that hand position in mind, so you'll just trade one problem for another set of problems in the long run. – PhilippFrank Jul 7 '15 at 6:54
  • 3
    Don't bother. Vim has got much better cursor motion commands than hjkl. See :help navigation. – romainl Jul 7 '15 at 6:56
11

First of all I will assume that you are using a QWERTY keyboard. My answer isn't based on my personal preference, I am simply reformulating a part of the amazing Practical Vim written by Drew Neil.

TL;DR Vim is optimized for the touch typists so your hands should stay where you learned to put them: left hand on asdf and right hand on jkl;

Neil says that putting your right hand on hjkl is a really bad thing to do. The main reason is that moving your cursor with the keys hjkl is something that should be very occasional because vim provides much faster word-wise movements or character search motion (w, b, f, t, /...).

I'll also directly quote this part:

I use the h and l keys for off-by-one errors, when I narrowly miss my target. Apart from that, I hardly touch them. Given how little I use the h key, I’m happy to have to stretch for it on a Qwerty keyboard. On the flip side, I use the character search commands often, so I’m pleased that the ; key rests comfortably beneath my little finger.

Bonus: Even if that doesn't seems to be your case here is a tip to get rid of the beginners bad habit consisting in using the arrow keys to move: Simply add the following lines to your .vimrc to disable totally the arrow keys:

noremap <Up>    <Nop>
noremap <Down>  <Nop>
noremap <Left>  <Nop>
noremap <Right> <Nop>

(<Nop> stands for "No Operation")

  • 5
    The "use hjkl keys, arrow keys are evil"-dogma is a strong one in the Vi/Vim community, but in many ways it's also a silly one. Aside from the fact that I'm not at all convinced it is actually faster in all scenarios, even if it would be, is this really the most important thing about learning Vim? Or are there other things that will save you a lot more time (like motions, dealing with marks, registers, VimScript basics, etc.).... The whole "hjkl"-thing seems like a micro-optimisation at best. – Martin Tournoij Jul 7 '15 at 8:06
  • 4
    I've been using computers for ~30 years. Every 5 years or so I renew my attempts to learn to type "properly". So far, every single time I did that I also developed acute carpal tunnel syndrome symptoms within the first few days. And every single time the symptoms went away as soon as I gave up and went back to my old habits. I've also been doing martial arts for ~40 years, and never had any joint problems. My habits include using the arrow keys, and moving the hands a lot while typing. The hjkl thing has never helped me. What did help was buying good quality mechanical keyboards. FWIW. – lcd047 Jul 7 '15 at 8:10
  • I answered the question because I read this a short time ago and I felt that it fitted well to the need of the OP. On the topic of hand placement, the french I am uses an AZERTY keyboard so the question doesn't actually exists: My left hand is on hjkl since the key on the right of l is m which is pretty useless. About the optimisation of using these keys to navigate I try to force myself to use the movements as much as I can but I still often use hjkl, I still feel it's faster than the arrow keys but I guess that its a pretty subjective topic. – statox Jul 7 '15 at 10:33
  • I want to balance @lcd047's comment by saying that I have the complete opposite experience. I had been sort of half way to touch typing for several years, keeping slipping back into old habits, till i started to use vim. To me, one of the benefits of using vim is precieley that its system of navigation and commands with simple keys, for example jkl;, forces you to keep your hands steady in good touch typing position in order to navigate the text. I am now a much quicker and more accurate typist as a result. – Andreas Oct 7 '15 at 5:45

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.