开发者

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

开发者 https://www.devze.com 2023-04-01 01:48 出处:网络
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.

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 rema开发者_如何学Cpping 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.


I found what I'm looking for:

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


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号