dvcolgan
dvcolgan

Reputation: 7728

How to swap keys in Vim normal mode, not just remap them?

I use Dvorak, so I have the following in my .vimrc:

no t j
no n k
no s l
no l n
no j t
no k s

which maps the directional keys to back to the right side of the home row.

This usually works quite well, except in plugins. For example, I can't navigate using up and down in the NERDTree plugin because it makes t something else.

Is there a way for me to, instead of simply remapping keys, tell Vim to consider a press of t in normal mode to be translated into a press of j, no matter what the context or plugin?

I seem to vaguely remember a vim command to alias one key to another, but I can't find it.

Upvotes: 5

Views: 1739

Answers (2)

dvcolgan
dvcolgan

Reputation: 7728

I found what I'm looking for:

set langmap=tj,nk,sl,ln,jt,ks

Upvotes: 3

dash-tom-bang
dash-tom-bang

Reputation: 17843

It may be worth simply learning the Dvorak locations for the keys. hjkl move, but (imho) not in a way that prevents their efficient use. h and l are index and pinky on your right hand, j and k are middle and index on your left.

It takes a while to remap your brain, but much of the Vi keyboard layout is mnemonic so it is easier than it could be (e.g. with emacs which is pretty Dvorak hostile IMHO).

Upvotes: 2

Related Questions