VIM Colemak取消重新映射问题 [英] VIM Colemak yank remapping issues

查看:134
本文介绍了VIM Colemak取消重新映射问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在Mac(Colemak)上使用了备用键盘布局,并且通过这样编辑.vimrc文件(仅两行以便获得图片)就重新映射了colemak布局的vim:

So I am using an alternate Keyboard layout on my Mac (Colemak) and I have vim remapped for colemak layout by editing the .vimrc file as such (just two lines so that you get the picture):

noremap y o  
noremap p r
... (and so on)

所以现在,在VIM中,当按Qemert布局上的 L 键(在QWERTY布局上)时,它类似于colemak上的 I ,它会按需打开插入模式.但是,当我按 y y 拉线时,它先执行 y ,然后执行 o .我现在需要将 y y 重新映射到 o 吗?

So now, in VIM when hitting the L key (on QWERTY layout) resembles I on colemak, it opens the Insert mode as it should. However, when I hit y y to yank a line, it instead executes y and then o. Do I need to remap y y to o now?

:map o yy

但这意味着在编辑模式下, o 会显示 y y ,不是吗?如果我写错了,请纠正我,并帮助我解决这个问题.

But that would mean that in editing mode an o would turn out y y, wouldn't it? Please correct me if I'm wrong and help me to solve this quirk.

推荐答案

.vimrc文件中的某个地方,您的y -> o映射似乎仅适用于

It looks like somewhere in your .vimrc file your y -> o mapping is made to only apply for operator-pending mode, since from what you wrote your first y registers as y.

您可以通过以下几种方法解决此问题:

You can work around this in a few ways:

  1. 取消映射 运算符的密钥仅模式:
  1. Unmap the key for operator mode only:
:ounmap y

  • o -> yy映射到 仅正常模式 (因此它不会影响您的编辑):

  • Map o -> yy to only normal mode (so it won't affect your editing):

    :nnoremap o yy
    

  • 只需对 Y (或 Y 的Colemak等效项)使用Vim的本机映射即可拉整整行.
  • Just use Vim's native mapping for Y (or the Colemak equivalent of Y) to yank the entire line.
  • 这篇关于VIM Colemak取消重新映射问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆