You may be familiar with the
y to copy selected text,
yy to copy the current line. To copy to the system clipboard, we'll use the same command with a few extras modifier to select the correct register.
Choosing a register
In Vim, you choose a register using
The system register
For both Mac and Windows, you can select the system register by using
Putting it all together
Enter visual mode by hitting
v. Select the text you want to copy, then type:
Now go paste freely!