I want to copy contents of the recently used "
register automatically into my system clipboard after a yank command.
The way I achieve this now is by nnoremap <C-@> :call system("wl-copy", @")<CR>
.
wl-copy
is a Command-line copy/paste utilities for Wayland and it will copy the input you give it to system clipboard.
What my mapping above achieves is
take the contents of the
"
register,- denoted by the
@"
argument
- denoted by the
and pass contents of
@"
as an argument to the systemwl-copy
function- shown by
:call system("wl-copy", @")
.
- shown by
But it requires me to press Ctrl + @
when I want to populate my system clipboard with contents of the "
register.
How can I automatically execute :call system("wl-copy", @")
after a yank command successfully finishes (I'd like to preserve y{motion}
but not have to continuously poll to see if the "
register changed.
Other solutions that achieve this effect are welcome.
TextYankPost
autocommand