Search code examples
vimkeyboard-shortcuts

vim - how to map Ctrl-y to "+y in visual mode?


I can yank a visual selection into the X clipboard in vim using "+y - I would like to map this to something more convenient. I tried mapping to Ctrl-y by adding :vmap <C-y> \"+y to my .vimrc but it doesn't work. How can I do this?


Solution

  • The problem was that I was escaping the " character. This, it seems, is wrong in this context. simply:

    :vmap <C-y> "+y
    

    works, as expected.