Search code examples
vimyankcolemak

VIM Colemak yank remapping issues


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)

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

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.


Solution

  • 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. Unmap the key for operator mode only:
      :ounmap y
      
    2. Map o -> yy to only normal mode (so it won't affect your editing):
      :nnoremap o yy
      
    3. Just use Vim's native mapping for Y (or the Colemak equivalent of Y) to yank the entire line.