如何在 Vim 正常模式下交换键,而不仅仅是重新映射它们?

发布于 2024-12-01 17:28:55 字数 310 浏览 0 评论 0原文

我使用 Dvorak,所以我的 .vimrc 中有以下内容:

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

它将方向键映射回主行的右侧。

这通常工作得很好,除了在插件中。例如,我无法在 NERDTree 插件中使用向上和向下导航,因为它会产生其他东西。

有没有办法让我不只是简单地重新映射按键,而是告诉 Vim 在正常模式下考虑将按 t 转换为按 j,无论上下文或插件如何?

我似乎隐约记得有一个 vim 命令可以将一个键别名为另一个键,但我找不到它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半衬遮猫 2024-12-08 17:28:55

我找到了我要找的东西:

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

I found what I'm looking for:

set langmap=tj,nk,sl,ln,jt,ks
深巷少女 2024-12-08 17:28:55

也许值得简单地了解德沃夏克琴键的位置。 hjkl 移动,但(恕我直言)不会以妨碍其有效使用的方式。 h 和 l 是右手的食指和小指,j 和 k 是左手的中指和食指。

重新映射你的大脑需要一段时间,但 Vi 键盘布局的大部分都是助记符,所以它比想象的要容易(例如,使用 emacs,恕我直言,它对德沃夏克相当敌对)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文