Last year I shared a Vim keybinding that I use quite frequently: I mapped gy
to "+y
, meaning that with the gy
I yank text into the system clipboard (without the awkwardness of typing double quote and plus).
I recently added another mapping to it: if I do gY
, it will actually yank the full content of the open file into my system clipboard. This saves me the awkwardness of typing gggyG
. See my mapping below though: by using the command style yank, I actually don't let the cursor jump, which is much nicer.
nmap gy "+y
vmap gy "+y
nmap gY :%y+<cr>