Breezy copy to system clipboard in Vim
When it's time to get text processed in Vim out of your editor and onto a shiny blog post many Vim Warriors reach for the awkward "copy to system register" keyboard chord.
"*y[motion]
Worse is trying to copy the whole file:
gg"*yG
This feat of keyboard heroism has crushed many heroes and inflicted countless RSI wounds.
It's time to slay the dragon 🐲 by adding these to your .vimrc:
" copy to system clipboard
map gy "*y
" copy whole file to system clipboard
nmap gY gg"*yG
Tweet