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?

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
john-jones
  • 7,490
  • 18
  • 53
  • 86
  • 10
    :) never stop minimizing your finger movement! – xtofl Jun 21 '10 at 10:44
  • 2
    I'm curious, so you say you're fine with using middlefinger-thirdfinger for your primary up-down movements ? – Jeffrey Jose Jun 22 '10 at 01:30
  • 1
    trigger finger=j, middle finger=k, ring finger=l, small finger=;, – john-jones Jun 22 '10 at 15:28
  • // , There's a question like this on vi.stackexchange.com, too: http://vi.stackexchange.com/questions/3546/how-to-remap-movement-keys-to-be-used-with-the-dvorak-keyboard-layout – Nathan Basanese Jun 09 '15 at 01:32
  • 2
    I find jkil to be more intuitive – Slava Dec 03 '15 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 03 '15 at 13:43
  • Thanks for this, it was useful to adapt the move keys for an `azerty` keyboard where the default position is on jklm. – JazZ Jul 30 '17 at 10:13

3 Answers3

42

use noremap:

noremap ; l
noremap l k
noremap k j
noremap j h
Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
5

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

Randy Morris
  • 39,631
  • 8
  • 69
  • 76
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

Community
  • 1
  • 1
Bukov
  • 650
  • 8
  • 19