馃懡 scientiac

How the hell do I copy from vim to my system clipboard, I always have to launch kate and copy and do :q on kate then clear it and then launch vim and do the rest.

2 months ago 路 馃憤 rwa

Actions

馃憢 Join Station

4 Replies

馃懡 negepezzannyitfiam

@scientiac for some reason Station stripped the plus characters from my previous comment. There should be a plus between " and y in my examples instead of a space. 路 2 months ago

馃懡 negepezzannyitfiam

To copy into a register, you can use "<register>y<movement>

So for example, to copy the text from the cursor position to the end of the current line into the a register, you can use:

"ay$

The system clipboard is a special register called . So if you want to copy into the system clipboard, you can type:

" y$

More examples:

" yi" - copy the contents of the next quote

" yt; - copy everything from the cursor to the next semicolon

etc.

In visual mode, you can use the same pattern but you don't specify a movement (because commands operate on the current selection). So you just select what you want to copy and type " y 路 2 months ago

馃懡 scientiac

I am using linux, I normally do :se nonu then copy by normal command then :se nu to bring back line numbering. But this is too many clicks. 路 2 months ago

馃懡 nristen

In visual mode: " (pick register) then * (system register in mac and windows) then y (yank). "*y 路 2 months ago