I have discovered the joy of having :set clipboard^=unnamedplus
.
One issue I often face however is having whatever was last copied or yanked be overwritten by what I just deleted.
I don't think manually referencing the blackhole ("_
) register everytime is a satisfactory solution, and doing :nnoremap d "_d
(or the same with x
) has the major downside of preventing me from using any other buffer ever for these operations.
I thought something like
augroup yankClips
" Like `:set clipboard^=unnamedplus`, but only with the yanks
autocmd!
autocmd TextYankPost * if v:event['operator'] == 'y' | let @+=@" | endif
augroup END
joined with not using :set clipboard^=unnamedplus
would solve my issues by only putting yanked text to the +
register, but removing unnamedplus from the clipboard prevents p
from putting what's inside the +
register by default.
Given these informations, does anybody know of a way of having what is essentially :set clipboard^=unnamedplus
without the d
, x
and s
operations going into the +
register?
"*p
. Though I imagine that would be Ctrl+V on Linux… Have you considered using:nnoremap <leader>p "+p
?<leader>p
for"+p
, but I think I would rather deal with the inconvenience of a regular, vanilla:set clipboard^=unnamedplus
than having to "use up"<leader>p
for that (though I don't have it mapped right now, I have thought of a couple of ways it could serve me). Your suggestion is very welcome, though it is not quite what I am asking.