john-jones
john-jones

Reputation: 7780

vim remapping the hjkl

I am trying to map the letters 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?

Upvotes: 26

Views: 21524

Answers (3)

Bukov
Bukov

Reputation: 656

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

Upvotes: 2

Lie Ryan
Lie Ryan

Reputation: 64837

use noremap:

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

Upvotes: 45

Randy Morris
Randy Morris

Reputation: 40927

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

Upvotes: 5

Related Questions