23

I am trying to map the letter hjkl to jkl in my .vimrc file so that I can have my fingers the way they always are on the keyboard, while writing in vim.

The problem is that as I map k to l, it jumps into the l to ;. so k becomes the same as ;. The same off course happens to all of them.

So all the keys become one because they copy through one another.

How can I prevent that?

7
  • 10
    :) never stop minimizing your finger movement!
    – xtofl
    Jun 21, 2010 at 10:44
  • 2
    I'm curious, so you say you're fine with using middlefinger-thirdfinger for your primary up-down movements ? Jun 22, 2010 at 1:30
  • 1
    trigger finger=j, middle finger=k, ring finger=l, small finger=;,
    – john-jones
    Jun 22, 2010 at 15:28
  • 2
    I find jkil to be more intuitive
    – Slava
    Dec 3, 2015 at 13:04
  • 1
    In the beginning it is but once you get used to moving using only the buttons right in front of the tip of your fingers in the default position, you move about slightly faster in the long run.
    – john-jones
    Dec 3, 2015 at 13:43

3 Answers 3

42

use noremap:

noremap ; l
noremap l k
noremap k j
noremap j h
4
  • Does this also work for related bindings such as <c-w>k? Or do I have to remap all of those as well?
    – user1804599
    Feb 11, 2015 at 8:55
  • 1
    // , Why is it called noremap? Jun 9, 2015 at 1:35
  • @37coins: :help noremap
    – Lie Ryan
    Jun 9, 2015 at 11:08
  • 3
    The nore in noremap stands for non-recursive. It is confusing. Feb 9, 2017 at 18:24
5

Check out :help noremap. This will prevent maps from recursively being mapped.

2

As a follow-up to @Lie Ryan's comment, I've written this Answer on a similar question

Basically, you might want to consider keeping:

j & k = up & down

since those are so primary

But then also consider:

l & ; = left & right

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.