To stop pasting over a selection from yanking that selection, I would like to remap p
so that it doesn't yank the just-rewritten selection:
vim.keymap.set("x", "p", [["_dP]])
xnoremap p "_dP
The remap deletes the text into a throwaway register first and then pastes. Unfortunately, as you can see, if a register were specified before pressing p
, then it won't be used by the remap.
E.g. one of my main workflows is to select many lines and replace them with the system clipboard with "+p
. The above mapping totally messes that up.
How can I remap for p
only, and not for "+p
, "ap
, "0p
etc.?