Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

editor

yank

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?

like image 298
Loom Avatar asked Apr 21 '14 10:04

Loom


1 Answers

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

like image 179
romainl Avatar answered Oct 01 '22 09:10

romainl