Search code examples
vimeditoryank

Yank range of lines to clipboard via ':' in vim


I'm yanking range of lines to system clipboard in vim. I can do it with 51gg116"+yy. I'd like to do it via : notation. I can copy to "" register via command :51,116y. However, command 51,116"+y doesn't work. How to fix the last command?


Solution

  • :help :y says:

    :[range]y[ank] [x]  Yank [range] lines [into register x]. Yanking to the
                        "* or "+ registers is possible only when the
                        |+clipboard| feature is included.
    

    so your answer is obviously:

    :51,116y +
    

    Your problem is that you try to use :y, the Ex command, as if it was y, the normal mode command.