Search code examples
vimkey-bindings

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.


Solution

  • I found what I'm looking for:

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